Closed fmaylinch closed 5 months ago
@fmaylinch that looks interesting, kind of dangerous though with multi on! I don't think this is general enough to apply to a lot of use cases. Perhaps with multi off it would be...
We usually want to update all matching docs (in fact it's very rare that we don't). But I understand; a third arg for multi is a good idea, especially as a double check when updating a single doc (even when the query matches only one).
By the way, your find().update() is also multi, isn't it? For me it's fine, since I never use non-multi. I first check my find to be sure what I'm matching and then I replace find by set (and the things I want to set). El 9 feb. 2016 23:12, "Tyler Brock" notifications@github.com escribió:
@fmaylinch https://github.com/fmaylinch that looks interesting, kind of dangerous though with multi on! I don't think this is general enough to apply to a lot of use cases. Perhaps with multi off it would be...
— Reply to this email directly or view it on GitHub https://github.com/TylerBrock/mongo-hacker/issues/151#issuecomment-182102309 .
You are correct the find().update() chain is also multi by default (so that it behaves more like sql).
Want to put up a pull request for the change?
Yes, I'll try.
In case you find it useful, we're using this extension. Just not to forget
$set
!