1MONGOC_DATABASE_READ_WRITE_COMMAMNODN_GWlOIiCTb_HmD_oAOnTPgAToBScA(S3E)_READ_WRITE_COMMAND_WITH_OPTS(3)
2
3
4

NAME

6       mongoc_database_read_write_command_with_opts       -       mongoc_data‐
7       base_read_write_command_with_opts()
8

SYNOPSIS

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

PARAMETERS

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

ERRORS

95       Errors are propagated via the error parameter.
96

RETURNS

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

EXAMPLE

104       See the example code for mongoc_client_read_command_with_opts().
105

AUTHOR

107       MongoDB, Inc
108
110       2017-present, MongoDB, Inc
111
112
113
114
1151.24.3                         MOANuGgOC1_7D,AT2A0B2A3SE_READ_WRITE_COMMAND_WITH_OPTS(3)
Impressum