1MONGOC_COLLECTION_SAVE(3) libmongoc MONGOC_COLLECTION_SAVE(3)
2
3
4
6 mongoc_collection_save - mongoc_collection_save()
7
9 This function is deprecated and should not be used in new code.
10
11 Please use mongoc_collection_insert_one() or mongoc_collection_re‐
12 place_one() with "upsert" instead.
13
15 bool
16 mongoc_collection_save (mongoc_collection_t *collection,
17 const bson_t *document,
18 const mongoc_write_concern_t *write_concern,
19 bson_error_t *error)
20 BSON_GNUC_DEPRECATED_FOR (mongoc_collection_insert_one or
21 mongoc_collection_replace_one);
22
24 • collection: A mongoc_collection_t.
25
26 • document: A bson_t containing the document.
27
28 • write_concern: A mongoc_write_concern_t or NULL for default write
29 concern.
30
31 • error: An optional location for a bson_error_t or NULL.
32
34 This function shall save a document into collection. If the document
35 has an _id field it will be updated. Otherwise it will be inserted.
36
38 Errors are propagated via the error parameter.
39
41 Returns true if successful. Returns false and sets error if there are
42 invalid arguments or a server or network error.
43
44 A write concern timeout or write concern error is considered a failure.
45
47 MongoDB, Inc
48
50 2017-present, MongoDB, Inc
51
52
53
54
551.20.0 Nov 18, 2021 MONGOC_COLLECTION_SAVE(3)