1MONGOC_CURSOR_NEW_FROM_COMMANDM_ORNEGPOLCYl__iCWbUImRToSHnO_gROo_PcNTESW(_3F)ROM_COMMAND_REPLY_WITH_OPTS(3)
2
3
4
6 mongoc_cursor_new_from_command_reply_with_opts - mongoc_cur‐
7 sor_new_from_command_reply_with_opts()
8
10 mongoc_cursor_t *
11 mongoc_cursor_new_from_command_reply_with_opts (mongoc_client_t *client,
12 bson_t *reply,
13 const bson_t *opts);
14
16 • client: A mongoc_client_t.
17
18 • reply: The reply to a command, such as "aggregate", "find", or "list‐
19 Collections", that returns a cursor document. The reply is destroyed
20 by mongoc_cursor_new_from_command_reply_with_opts and must not be ac‐
21 cessed afterward.
22
23 • opts: A bson_t.
24
25 opts may be NULL or a BSON document with additional options, which have
26 the same meaning for this function as for
27 mongoc_collection_find_with_opts():
28
29 • awaitData
30
31 • batchSize
32
33 • limit
34
35 • maxAwaitTimeMS
36
37 • serverId
38
39 • sessionId
40
41 • skip
42
43 • tailable
44
46 Some MongoDB commands return a "cursor" document. For example, given an
47 "aggregate" command:
48
49 { "aggregate" : "collection", "pipeline" : [], "cursor" : {}}
50
51 The server replies:
52
53 {
54 "cursor" : {
55 "id" : 1234,
56 "ns" : "db.collection",
57 "firstBatch" : [ ]
58 },
59 "ok" : 1
60 }
61
62 mongoc_cursor_new_from_command_reply_with_opts is a low-level function
63 that initializes a mongoc_cursor_t from such a reply.
64
65 When synthesizing a completed cursor response that has no more batches
66 (i.e. with cursor id 0), serverId may be 0. If the cursor response is
67 not completed (i.e. with non-zero cursor id), pass the serverId of the
68 server used to create the cursor.
69
70 Use this function only for building a language driver that wraps the C
71 Driver. When writing applications in C, higher-level functions such as
72 mongoc_collection_aggregate() are more appropriate, and ensure compati‐
73 bility with a range of MongoDB versions.
74
76 A mongoc_cursor_t. On failure, the cursor's error is set. Check for
77 failure with mongoc_cursor_error().
78
80 MongoDB, Inc
81
83 2017-present, MongoDB, Inc
84
85
86
87
881.24.3 MONGAOuCg_C1U7R,SO2R0_2N3EW_FROM_COMMAND_REPLY_WITH_OPTS(3)