1MONGOC_WRITE_CONCERN_T(3)          libmongoc         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 ob‐
16       jects, collection objects, or per-operation. Data-modifying  operations
17       typically  use  the  write  concern  of the object they operate on, and
18       check the server response for a write concern error  or  write  concern
19       timeout.  For  example, mongoc_collection_drop_index() uses the collec‐
20       tion's write concern, and a write concern error or timeout in  the  re‐
21       sponse is considered a failure.
22
23       Exceptions to this principle are the generic command functions:
24
25mongoc_client_command()
26
27mongoc_client_command_simple()
28
29mongoc_database_command()
30
31mongoc_database_command_simple()
32
33mongoc_collection_command()
34
35mongoc_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 er‐
39       ror 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_CONCERN_W_DE‐ │ By default,  writes  block │
48              │FAULT (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_CONCERN_W_UN‐ │ With  this  write concern, │
56              │ACKNOWLEDGED (0)           │ MongoDB does not  acknowl‐ │
57              │                           │ edge  the receipt of write │
58              │                           │ operation.  Unacknowledged │
59              │                           │ is  similar  to errors ig‐ │
60              │                           │ nored; however, mongoc at‐ │
61              │                           │ tempts to receive and han‐ │
62              │                           │ dle  network  errors  when │
63              │                           │ possible.                  │
64              └───────────────────────────┴────────────────────────────┘
65
66
67              │MONGOC_WRITE_CONCERN_W_MA‐ │ Block until  a  write  has │
68              │JORITY (majority)          │ been  propagated  to a ma‐ │
69              │                           │ jority of the nodes in the │
70              │                           │ 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.23.1                           Oct 20, 2022        MONGOC_WRITE_CONCERN_T(3)
Impressum