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