1MONGOC_CLIENT_READ_WRITE_COMMAND_WMIOTlNHiG_bOOmCPo_TnCSgL(oI3cE)NT_READ_WRITE_COMMAND_WITH_OPTS(3)
2
3
4

SYNOPSIS

6          bool
7          mongoc_client_read_write_command_with_opts (
8             mongoc_client_t *client,
9             const char *db_name,
10             const bson_t *command,
11             const mongoc_read_prefs_t *read_prefs /* UNUSED */,
12             const bson_t *opts,
13             bson_t *reply,
14             bson_error_t *error);
15
16       Execute  a command on the server, applying logic for commands that both
17       read and write, and taking the MongoDB server version into account.  To
18       send  a  raw  command  to  the  server  without  any of this logic, use
19       mongoc_client_command_simple().
20
21       Use this function for commands  that  both  read  and  write,  such  as
22       "mapReduce" with an output collection.
23
24       Read  and  write  concern  and  collation  can be overridden by various
25       sources. In a transaction, read concern and write concern  are  prohib‐
26       ited in opts. The highest-priority sources for these options are listed
27       first in the following table. Read preferences  are  not  applied.  The
28       write concern is omitted for MongoDB before 3.4.
29
30                     ┌─────────────┬───────────────┬───────────┐
31                     │Read Concern │ Write Concern │ Collation │
32                     ├─────────────┼───────────────┼───────────┤
33opts         opts          opts      
34                     ├─────────────┼───────────────┼───────────┤
35                     │Transaction  │ Transaction   │           │
36                     ├─────────────┼───────────────┼───────────┤
37client       client        │           │
38                     └─────────────┴───────────────┴───────────┘
39
40       See  the  example  for transactions and for the "distinct" command with
41       opts.
42
43       reply is always initialized, and must be freed with bson_destroy().
44
45       (The mongoc_read_prefs_t parameter was included by  mistake  when  this
46       function  was  introduced  in libmongoc 1.5. A command that writes must
47       not obey a read preference.)
48

PARAMETERS

50client: A mongoc_client_t.
51
52db_name: The name of the database to run the command on.
53
54command: A bson_t containing the command specification.
55
56read_prefs: Ignored.
57
58opts: A bson_t containing additional options.
59
60reply: A location for the resulting document.
61
62error: An optional location for a bson_error_t or NULL.
63
64       opts may be NULL or a BSON document with additional command options:
65
66readConcern:    Construct    a    mongoc_read_concern_t    and    use
67         mongoc_read_concern_append() to add the read concern to opts. See the
68         example code for mongoc_client_read_command_with_opts(). Read concern
69         requires MongoDB 3.2 or later, otherwise an error is returned.
70
71writeConcern:    Construct    a    mongoc_write_concern_t   and   use
72         mongoc_write_concern_append() to add the write concern to  opts.  See
73         the example code for mongoc_client_write_command_with_opts().
74
75sessionId:    First,   construct   a   mongoc_client_session_t   with
76         mongoc_client_start_session().  You  can  begin  a  transaction  with
77         mongoc_client_session_start_transaction(),    optionally    with    a
78         mongoc_transaction_opt_t that overrides the  options  inherited  from
79         client,  and use mongoc_client_session_append() to add the session to
80         opts. See the example code for mongoc_client_session_t.
81
82collation: Configure textual comparisons. See Setting  Collation  Or‐
83         der,  and  the  MongoDB Manual entry on Collation. Collation requires
84         MongoDB 3.2 or later, otherwise an error is returned.
85
86serverId: To target a specific server, include  an  int32  "serverId"
87         field.  Obtain  the id by calling mongoc_client_select_server(), then
88         mongoc_server_description_id() on its return value.
89
90       Consult the MongoDB Manual entry on Database  Commands  for  each  com‐
91       mand's arguments.
92

ERRORS

94       Errors are propagated via the error parameter.
95

RETURNS

97       Returns  true  if successful. Returns false and sets error if there are
98       invalid arguments or a server or network error.
99
100       A write concern timeout or write concern error is considered a failure.
101

EXAMPLE

103       See the example code for mongoc_client_read_command_with_opts().
104

AUTHOR

106       MongoDB, Inc
107
109       2017-present, MongoDB, Inc
110
111
112
113
1141.25.1                           NMoOvNG0O8C,_C2L0I2E3NT_READ_WRITE_COMMAND_WITH_OPTS(3)
Impressum