I'm confused, in the online doc code snippets , it shows the use of finalization when calling the update_many method, for example:
mongocxx::stdx::optional<mongocxx::result::update> result = collection.update_many( document{} << "i" << open_document << "$lt" << 100 << close_document << finalize, document{} << "$inc" << open_document << "i" << 100 << close_document << finalize);
But I saw the example code in the mongocxx driver code without finalizing
// Update multiple documents. { // @begin: cpp-update-multiple-documents bsoncxx::builder::stream::document filter_builder, update_builder; filter_builder << "address.zipcode" << "10016" << "cuisine" << "Other"; update_builder << "$set" << open_document << "cuisine" << "Category To Be Determined" << close_document << "$currentDate" << open_document << "lastModified" << true << close_document; db["restaurants"].update_many(filter_builder.view(), update_builder.view()); // @end: cpp-update-multiple-documents }
So what is the difference between using finalization or not using? How to make a choice?
source share