1MONGOC_COLLECTION_INSERT(3) libmongoc MONGOC_COLLECTION_INSERT(3)
2
3
4
6 mongoc_collection_insert - mongoc_collection_insert()
7
9 bool
10 mongoc_collection_insert (mongoc_collection_t *collection,
11 mongoc_insert_flags_t flags,
12 const bson_t *document,
13 const mongoc_write_concern_t *write_concern,
14 bson_error_t *error);
15
17 · collection: A mongoc_collection_t.
18
19 · flags: A mongoc_insert_flags_t.
20
21 · document: A bson_t.
22
23 · write_concern: A mongoc_write_concern_t.
24
25 · error: An optional location for a bson_error_t or NULL.
26
28 Superseded by mongoc_collection_insert_one() and mongoc_collec‐
29 tion_insert_many().
30
31 This function shall insert document into collection.
32
33 If no _id element is found in document, then a bson_oid_t will be gen‐
34 erated locally and added to the document. If you must know the inserted
35 document's _id, generate it in your code and include it in the docu‐
36 ment. The _id you generate can be a bson_oid_t or any other non-array
37 BSON type.
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.17.4 Feb 04, 2021 MONGOC_COLLECTION_INSERT(3)