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