I am confused, in code snippets of online doc, it shows the usage of finalize when calling update_many method, like so:
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 have seen the example code in mongocxx driver code without finalize
// 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 difference between using finalize or not using it? How to make a choice?