1MONGOC_DATABASE_COMMAND(3) libmongoc MONGOC_DATABASE_COMMAND(3)
2
3
4
6 mongoc_database_command - mongoc_database_command()
7
9 mongoc_cursor_t *
10 mongoc_database_command (mongoc_database_t *database,
11 mongoc_query_flags_t flags,
12 uint32_t skip,
13 uint32_t limit,
14 uint32_t batch_size,
15 const bson_t *command,
16 const bson_t *fields,
17 const mongoc_read_prefs_t *read_prefs)
18 BSON_GNUC_WARN_UNUSED_RESULT;
19
20 This function is superseded by mongoc_database_command_with_opts(),
21 mongoc_database_read_command_with_opts(), mongoc_database_write_com‐
22 mand_with_opts(), and mongoc_database_read_write_command_with_opts().
23
25 This function creates a cursor which will execute the command when mon‐
26 goc_cursor_next is called on it. The database's read preference, read
27 concern, and write concern are not applied to the command, and mon‐
28 goc_cursor_next will not check the server response for a write concern
29 error or write concern timeout.
30
31 This function is not considered a retryable read operation.
32
34 • database: A mongoc_database_t.
35
36 • flags: A mongoc_query_flags_t.
37
38 • skip: The number of documents to skip on the server.
39
40 • limit: The maximum number of documents to return from the cursor.
41
42 • batch_size: Attempt to batch results from the server in groups of
43 batch_size documents.
44
45 • command: A bson_t containing the command.
46
47 • fields: An optional bson_t containing the fields to return. NULL for
48 all fields.
49
50 • read_prefs: An optional mongoc_read_prefs_t. Otherwise, the command
51 uses mode MONGOC_READ_PRIMARY.
52
54 This function returns a newly allocated mongoc_cursor_t that should be
55 freed with mongoc_cursor_destroy() when no longer in use. The returned
56 mongoc_cursor_t is never NULL, even on error. The user must call mon‐
57 goc_cursor_next() on the returned mongoc_cursor_t to execute the ini‐
58 tial command.
59
60 Cursor errors can be checked with mongoc_cursor_error_document. It al‐
61 ways fills out the bson_error_t if an error occurred, and optionally
62 includes a server reply document if the error occurred server-side.
63
64 WARNING:
65 Failure to handle the result of this function is a programming er‐
66 ror.
67
69 MongoDB, Inc
70
72 2017-present, MongoDB, Inc
73
74
75
76
771.20.0 Nov 18, 2021 MONGOC_DATABASE_COMMAND(3)