-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: libmongoc
-
None
We need a way to be able to extend the mongoc_collection_find_and_modify () helper for new options, for example bypassDocumentValidation.
typedef enum { MONGOC_FIND_AND_MODIFY_NONE = 0, MONGOC_FIND_AND_MODIFY_REMOVE = 1 << 0, MONGOC_FIND_AND_MODIFY_UPSERT = 1 << 1, MONGOC_FIND_AND_MODIFY_RETURN_NEW = 1 << 2, } mongoc_find_and_modify_flags_t; typedef struct _mongoc_find_and_modify_opts_t mongoc_find_and_modify_opts_t ;
mongoc_find_and_modify_opts_t* mongoc_find_and_modify_opts_new (void); bool mongoc_find_and_modify_opts_set_sort (mongoc_find_and_modify_opts_t *opts, const bson_t *sort); bool mongoc_find_and_modify_opts_set_update (mongoc_find_and_modify_opts_t *opts, const bson_t *update); bool mongoc_find_and_modify_opts_set_fields (mongoc_find_and_modify_opts_t *opts, const bson_t *fields); bool mongoc_find_and_modify_opts_set_flags (mongoc_find_and_modify_opts_t *opts, const mongoc_find_and_modify_flags_t flags); bool mongoc_find_and_modify_opts_set_bypass_document_validation (mongoc_find_and_modify_opts_t *opts, bool bypass); void mongoc_find_and_modify_opts_destroy (mongoc_find_and_modify_opts_t *opts);
bool mongoc_collection_find_and_modify_with_opts (mongoc_collection_t *collection, const bson_t *query, const mongoc_find_and_modify_opts_t *opts, bson_t *reply, bson_error_t *error);
Note that setting write_concern is not supported through the builder.
Write concern must be set the collection level, which findAndModify will "inherit" and use when talking to MongoDB 3.2 and later.
mongoc_collection_set_write_concern (collection, write_concern); mongoc_collection_find_and_modify_with_opts (collection, query, find_and_modify_opts, &reply, &error);
- is related to
-
CDRIVER-1047 Add mongoc_find_and_modify_opts_set_max_time_ms ()
- Closed
-
CXX-690 Support bypassDocumentValidation
- Closed
- related to
-
CDRIVER-893 Support bypassDocumentValidation
- Closed
-
CDRIVER-1048 Add generic mongoc_find_and_modify_opts_append
- Closed
-
CXX-693 findAndModify take a write concern
- Closed
-
CDRIVER-824 collection_find_and_modify() should apply the mongoc_collection_t write_concern
- Closed
-
CDRIVER-1008 Document new find_and_modify builder
- Closed