javascript - limit() isn't working for me in when using find() -
javascript - limit() isn't working for me in when using find() -
i new mongodb , meteor.js , trying check if document existed in collection.
i know can utilize findone
or find({condition}).count()
, article here made point faster use:
find({condition}).limit(1).size().
when utilize like
playerslist.find({'name':"bill"}).limit(1).size()
where playerslist
collection, error saying: "typeerror: undefined not function (evaluating 'playerslist.find({'name':playername}).limit(1)')"
can explain doing wrong?
the minimongo api implemented in metor not same mongo api implemented in mongo shell. in case, limit function not implemented in meteorjs "minimongo" cursor binding. instead set limit in options of find function.
posts.find({name:"bill"}, {limit:1}).count()
take @ http://docs.meteor.com/#find , read find function options.
javascript mongodb find limit
Comments
Post a Comment