【发布时间】:2017-06-24 21:53:22
【问题描述】:
我需要使用 Mongoose 检索 MongoDB 数据库中位置 1,5 和 8 的文档。 是否有可能通过文档在集合中的位置来获取文档?如果是这样,你能告诉我怎么做吗?
我需要这样的东西:
var someDocs = MyModel.find({<collectionIndex>: [1, 5, 8]}, function(err, docs) {
//do something with the three documents
})
我尝试执行以下操作以查看集合中使用了哪些索引,但我收到“getIndexes 不是函数”错误:
var indexes = MyModel.getIndexes();
感谢任何帮助。
【问题讨论】:
标签: node.js mongodb mongoose mongodb-query mongoose-schema