1MONGOC_COLLECTION_COMMAND(3) libmongoc MONGOC_COLLECTION_COMMAND(3)
2
3
4
6 mongoc_cursor_t *
7 mongoc_collection_command (mongoc_collection_t *collection,
8 mongoc_query_flags_t flags,
9 uint32_t skip,
10 uint32_t limit,
11 uint32_t batch_size,
12 const bson_t *command,
13 const bson_t *fields,
14 const mongoc_read_prefs_t *read_prefs)
15 BSON_GNUC_WARN_UNUSED_RESULT;
16
17 This function is superseded by mongoc_collection_command_with_opts(),
18 mongoc_collection_read_command_with_opts(),
19 mongoc_collection_write_command_with_opts(), and
20 mongoc_collection_read_write_command_with_opts().
21
22 This function is not considered a retryable read operation.
23
25 • collection: A mongoc_collection_t.
26
27 • flags: A mongoc_query_flags_t.
28
29 • skip: A uint32_t with the number of documents to skip or zero.
30
31 • limit: A uint32_t with the max number of documents to return or zero.
32
33 • batch_size: A uint32_t with the number of documents in each batch or
34 zero. Default is 100.
35
36 • command: A bson_t containing the command to execute.
37
38 • fields: A bson_t containing the fields to return or NULL. Not all
39 commands support this option.
40
41 • read_prefs: An optional mongoc_read_prefs_t. Otherwise, the command
42 uses mode MONGOC_READ_PRIMARY.
43
45 This function returns a newly allocated mongoc_cursor_t that should be
46 freed with mongoc_cursor_destroy() when no longer in use. The returned
47 mongoc_cursor_t is never NULL, even on error. The user must call
48 mongoc_cursor_next() on the returned mongoc_cursor_t to execute the
49 initial command.
50
51 Cursor errors can be checked with mongoc_cursor_error_document(). It
52 always fills out the bson_error_t if an error occurred, and optionally
53 includes a server reply document if the error occurred server-side.
54
55 WARNING:
56 Failure to handle the result of this function is a programming er‐
57 ror.
58
60 MongoDB, Inc
61
63 2017-present, MongoDB, Inc
64
65
66
67
681.25.1 Nov 08, 2023 MONGOC_COLLECTION_COMMAND(3)