-
Type:
Task
-
Resolution: Done
-
Priority:
Trivial - P5
-
None
-
Affects Version/s: 3.0.1
-
Component/s: Implementation
-
None
-
Environment:Windows 10
MS VS 2015
MongoDB 3.3.5
MongoDB C++11 Driver 3.0.1
-
None
-
None
-
None
-
None
-
None
-
None
-
None
According to the update tutorial to replace one:
db[this->id()].replace_one(filter_builder.view(), bsb_file_blueprint.view());
It goes on to state:
By specifying the upsert option to true, the update operation either updates matching document(s) or inserts a new document if no matching document exists.
referring me to the C++11 documentation but without an example.
I have (using the bulk_write.cpp example):
{{mongocxx::model::replace_one upsert_op(filter_builder.view(), bsb_file_blueprint.view());
upsert_op.upsert(true);}}
But I'm unsure what to do next. Am I to do a bulk_write? Is there an easier way?