Last active
December 16, 2015 02:59
-
-
Save davetapley/5366519 to your computer and use it in GitHub Desktop.
Count for mongojs cursor is returned incorrectly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var testCollection = require('mongojs')('test').collection('testCollection'), | |
shouldBeOneDoc = testCollection.find({}).sort({ myField : 1 }).limit(1); | |
shouldBeOneDoc.count(function (err, count) { console.log(count) }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If
testCollection
has more than one document, thecount
will be the total number of documents, seemingly disregarding thelimit(1)
.