1MONGOC_CURSOR_NEW_FROM_COMMAND_RMEoPnLgYo(D3B)CMODNrGiOvCe_rCURSOR_NEW_FROM_COMMAND_REPLY(3)
2
3
4
6 mongoc_cursor_new_from_command_reply - mongoc_cursor_new_from_com‐
7 mand_reply()
8
10 mongoc_cursor_t *
11 mongoc_cursor_new_from_command_reply (mongoc_client_t *client,
12 bson_t *reply,
13 uint32_t server_id);
14 BSON_GNUC_DEPRECATED_FOR (mongoc_cursor_new_from_command_reply_with_opts);
15
17 This function is deprecated and should not be used in new code.
18
19 Please use mongoc_cursor_new_from_command_reply_with_opts() instead.
20
21 When migrating from the deprecated mongoc_cursor_new_from_com‐
22 mand_reply() to mongoc_cursor_new_from_command_reply_with_opts(), note
23 that options previously passed to the reply argument (e.g. "batchSize")
24 must instead be provided in the opts argument.
25
27 · client: A mongoc_client_t.
28
29 · reply: The reply to a command, such as "aggregate", "find", or "list‐
30 Collections", that returns a cursor document. The reply is destroyed
31 by mongoc_cursor_new_from_command_reply and must not be accessed
32 afterward.
33
34 · server_id: The opaque id of the server used to execute the command.
35
37 Some MongoDB commands return a "cursor" document. For example, given an
38 "aggregate" command:
39
40 { "aggregate" : "collection", "pipeline" : [], "cursor" : {}}
41
42 The server replies:
43
44 {
45 "cursor" : {
46 "id" : 1234,
47 "ns" : "db.collection",
48 "firstBatch" : [ ]
49 },
50 "ok" : 1
51 }
52
53 mongoc_cursor_new_from_command_reply is a low-level function that ini‐
54 tializes a mongoc_cursor_t from such a reply. Additional options such
55 as "tailable" or "awaitData" can be included in the reply.
56
57 When synthesizing a completed cursor response that has no more batches
58 (i.e. with cursor id 0), set server_id to 0 as well.
59
60 Use this function only for building a language driver that wraps the C
61 Driver. When writing applications in C, higher-level functions such as
62 mongoc_collection_aggregate are more appropriate, and ensure compati‐
63 bility with a range of MongoDB versions.
64
66 A mongoc_cursor_t. On failure, the cursor's error is set. Check for
67 failure with mongoc_cursor_error.
68
70 MongoDB, Inc
71
73 2017-present, MongoDB, Inc
74
75
76
77
781.14.0 Feb 22,MO2N0G1O9C_CURSOR_NEW_FROM_COMMAND_REPLY(3)