Node.js nodejsmongodb驱动程序:如何组合索引提示和投影
努力将索引提示和查询投影与Nodejs驱动程序结合起来 如果我们只包含一个提示,则此操作有效:Node.js nodejsmongodb驱动程序:如何组合索引提示和投影,node.js,mongodb,node-mongodb-native,Node.js,Mongodb,Node Mongodb Native,努力将索引提示和查询投影与Nodejs驱动程序结合起来 如果我们只包含一个提示,则此操作有效: db.collection('battle').find({}, {'hint': 'myindex'}).toArray(); 如果我们只包含一个投影,则此操作有效: db.collection('battle').find({}, {'result.replay': 0}).toArray(); db.collection('battle').find({}, {'hint': 'myinde
db.collection('battle').find({}, {'hint': 'myindex'}).toArray();
如果我们只包含一个投影,则此操作有效:
db.collection('battle').find({}, {'result.replay': 0}).toArray();
db.collection('battle').find({}, {'hint': 'myindex', 'result.replay': 0}).toArray();
但是,这忽略了预测:
db.collection('battle').find({}, {'result.replay': 0}).toArray();
db.collection('battle').find({}, {'hint': 'myindex', 'result.replay': 0}).toArray();
似乎我的订单不正确:
var cursor = collection.find(query, [fields], options);
这意味着:
db.collection('battle').find({}, {'result.replay': 0}, {'hint': 'myindex'}).toArray();