1MONGOC_WRITE_CONCERN_T(3)      MongoDB C Driver      MONGOC_WRITE_CONCERN_T(3)
2
3
4

NAME

6       mongoc_write_concern_t - mongoc_write_concern_t
7
8       Write Concern abstraction
9

SYNOPSIS

11       mongoc_write_concern_t  tells  the driver what level of acknowledgement
12       to await from the server. The default,  MONGOC_WRITE_CONCERN_W_DEFAULT,
13       is right for the great majority of applications.
14
15       You  can  specify  a  write  concern  on  connection  objects, database
16       objects, collection objects, or  per-operation.  Data-modifying  opera‐
17       tions  typically  use  the write concern of the object they operate on,
18       and check the server response for a write concern error or  write  con‐
19       cern  timeout.  For example, mongoc_collection_drop_index uses the col‐
20       lection's write concern, and a write concern error or  timeout  in  the
21       response is considered a failure.
22
23       Exceptions to this principle are the generic command functions:
24
25       · mongoc_client_command
26
27       · mongoc_client_command_simple
28
29       · mongoc_database_command
30
31       · mongoc_database_command_simple
32
33       · mongoc_collection_command
34
35       · mongoc_collection_command_simple
36
37       These generic command functions do not automatically apply a write con‐
38       cern, and they do not check the server response  for  a  write  concern
39       error or write concern timeout.
40
41       See Write Concern on the MongoDB website for more information.
42

WRITE CONCERN LEVELS

44       Set the write concern level with mongoc_write_concern_set_w.
45
46              ┌───────────────────────────┬────────────────────────────┐
47              │MONGOC_WRITE_CON‐          │ By default,  writes  block │
48              │CERN_W_DEFAULT (1)         │ awaiting   acknowledgement │
49              │                           │ from MongoDB. Acknowledged │
50              │                           │ write    concern    allows │
51              │                           │ clients to catch  network, │
52              │                           │ duplicate  key,  and other │
53              │                           │ errors.                    │
54              ├───────────────────────────┼────────────────────────────┤
55              │MONGOC_WRITE_CON‐          │ With  this  write concern, │
56              │CERN_W_UNACKNOWLEDGED (0)  │ MongoDB does not  acknowl‐ │
57              │                           │ edge  the receipt of write │
58              │                           │ operation.  Unacknowledged │
59              │                           │ is   similar   to   errors │
60              │                           │ ignored;  however,  mongoc │
61              │                           │ attempts  to  receive  and │
62              │                           │ handle network errors when │
63              │                           │ possible.                  │
64              └───────────────────────────┴────────────────────────────┘
65
66
67              │MONGOC_WRITE_CON‐          │ Block until  a  write  has │
68              │CERN_W_MAJORITY (majority) │ been   propagated   to   a │
69              │                           │ majority of the  nodes  in │
70              │                           │ the replica set.           │
71              ├───────────────────────────┼────────────────────────────┤
72              │n                          │ Block  until  a  write has │
73              │                           │ been  propagated   to   at │
74              │                           │ least   n   nodes  in  the │
75              │                           │ replica set.               │
76              └───────────────────────────┴────────────────────────────┘
77

DEPRECATIONS

79       The write concern MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED (value -1) is a
80       deprecated synonym for MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED (value 0),
81       and will be removed in the next major release.
82
83       mongoc_write_concern_set_fsync is deprecated.
84

AUTHOR

86       MongoDB, Inc
87
89       2017-present, MongoDB, Inc
90
91
92
93
941.13.1                           Jan 24, 2019        MONGOC_WRITE_CONCERN_T(3)
Impressum