Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow findAndModify to take an options parameter: BREAKING CHANGE #911
The third parameter to findAndModify was previously set as the returnFieldSelector. The problem with this is that the findAndModify function in mongo takes quite a large number of optional parameters, such as the very commonly used "new" parameter.
This fix replaces the third parameter with an options argument which should take anything that can be iterated as an associative array (such as a Json or Bson object)
auto result = collection.findAndModify( ["_id": Bson(_id), "count": Bson(count)], ["$inc": Bson(["count": Bson(1)], ["new": true] );
To achieve this, I have strayed away from using the CMD struct, but the struct doesn't allow for optional parameters.
I don't know if this works for
It would also be nice to assemble the command without doing dynamic memory allocations (which