我是 MongoDB 和 Meteor.js 的新手,正在尝试检查集合中是否存在文档。
我知道我可以使用findOneor find({condition}).count(),但是这里的一篇文章指出使用它会更快:
find({condition}).limit(1).size().
Run Code Online (Sandbox Code Playgroud)
当我使用类似的东西时
PlayersList.find({'name':"Bill"}).limit(1).size()
Run Code Online (Sandbox Code Playgroud)
wherePlayersList是一个集合,我收到一条错误消息:“TypeError: undefined is not a function (evaluating 'PlayersList.find({'name':playerName}).limit(1)')”
有人可以解释我做错了什么吗?