1MONGOC_COLLECTION_COMMAND(3)       libmongoc      MONGOC_COLLECTION_COMMAND(3)
2
3
4

NAME

6       mongoc_collection_command - mongoc_collection_command()
7

SYNOPSIS

9          mongoc_cursor_t *
10          mongoc_collection_command (mongoc_collection_t *collection,
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_collection_command_with_opts(),
21       mongoc_collection_read_command_with_opts(),              mongoc_collec‐
22       tion_write_command_with_opts(),  and  mongoc_collection_read_write_com‐
23       mand_with_opts().
24
25       This function is not considered a retryable read operation.
26

PARAMETERS

28collection: A mongoc_collection_t.
29
30flags: A mongoc_query_flags_t.
31
32skip: A uint32_t with the number of documents to skip or zero.
33
34limit: A uint32_t with the max number of documents to return or zero.
35
36batch_size: A uint32_t with the number of documents in each batch  or
37         zero. Default is 100.
38
39command: A bson_t containing the command to execute.
40
41fields:  A  bson_t  containing  the fields to return or NULL. Not all
42         commands support this option.
43
44read_prefs: An optional mongoc_read_prefs_t. Otherwise,  the  command
45         uses mode MONGOC_READ_PRIMARY.
46

RETURNS

48       This  function returns a newly allocated mongoc_cursor_t that should be
49       freed with mongoc_cursor_destroy() when no longer in use. The  returned
50       mongoc_cursor_t  is  never NULL, even on error. The user must call mon‐
51       goc_cursor_next() on the returned mongoc_cursor_t to execute  the  ini‐
52       tial command.
53
54       Cursor  errors can be checked with mongoc_cursor_error_document. It al‐
55       ways fills out the bson_error_t if an error  occurred,  and  optionally
56       includes a server reply document if the error occurred server-side.
57
58       WARNING:
59          Failure  to  handle the result of this function is a programming er‐
60          ror.
61

AUTHOR

63       MongoDB, Inc
64
66       2017-present, MongoDB, Inc
67
68
69
70
711.21.1                           Mar 02, 2022     MONGOC_COLLECTION_COMMAND(3)
Impressum