1MONGOC_CURSOR_NEW_FROM_COMMAND_REPLYl(i3b)moMnOgNoGcOC_CURSOR_NEW_FROM_COMMAND_REPLY(3)
2
3
4
6 Deprecated since version 1.11.0: This function is deprecated and
7 should not be used in new code.
8
9 Please use mongoc_cursor_new_from_command_reply_with_opts() in new
10 code.
11
12 When migrating from the deprecated
13 mongoc_cursor_new_from_command_reply() to
14 mongoc_cursor_new_from_command_reply_with_opts(), note that options
15 previously passed to the reply argument (e.g. "batchSize") must in‐
16 stead be provided in the opts argument.
17
18
20 mongoc_cursor_t *
21 mongoc_cursor_new_from_command_reply (mongoc_client_t *client,
22 bson_t *reply,
23 uint32_t server_id);
24 BSON_GNUC_DEPRECATED_FOR (mongoc_cursor_new_from_command_reply_with_opts);
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 af‐
32 terward.
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), server_id may be 0. If the cursor response is
59 not completed (i.e. with non-zero cursor id), pass the server_id of the
60 server used to create the cursor.
61
62 Use this function only for building a language driver that wraps the C
63 Driver. When writing applications in C, higher-level functions such as
64 mongoc_collection_aggregate() are more appropriate, and ensure compati‐
65 bility with a range of MongoDB versions.
66
68 A mongoc_cursor_t. On failure, the cursor's error is set. Check for
69 failure with mongoc_cursor_error().
70
72 MongoDB, Inc
73
75 2017-present, MongoDB, Inc
76
77
78
79
801.25.1 Nov 08,MO2N0G2O3C_CURSOR_NEW_FROM_COMMAND_REPLY(3)