Closed (fixed)
Project:
MongoDB
Version:
7.x-1.x-dev
Component:
Block
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
22 Aug 2013 at 20:03 UTC
Updated:
2 Sep 2015 at 06:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
marcingy commentedComment #2
jyee commentedThis can be simplified by simply calling find(). Limiting the return to only the _id isn't necessary, since Mongo is only returning the result of hasNext().
Comment #3
fgmI wasn't sure that it was actually faster, and this is not obvious in the Mongo shell, so I checked and found this blog entry which clearl confirms it:
https://blog.serverdensity.com/checking-if-a-document-exists-mongodb-slo...
Added a comment to specify this and committed to 7.x-1.x, thanks.