mongodb/node-mongodb-native — pull request #1216 by sergeyksv (2014-10-08 07:55:39+00:00)
Title: Use findOne instead of find followed by nextObject

GridFS code uses combination of find followed by nextObject to fetch things (file or chunk) know to exists in zero or on instance. The problem is that after using nextObject cursor object remain opened, at least on driver logic level. Logic issue cause memory leak in NewRelic instrumentation module which keep tracer object linked to this specific object. However I believe that forgotten alive cursor can cause more serious issue.
The findOne actually does same thing (find + nextObject) but it sets batch size to 1, which makes cursor to close automatically. Anyway, I believe use of findOne is more appropriate for this code.