MongoDB在排序后找到文档的位置

时间:2017-07-04 19:23:20

标签: mongodb

是否可以获取查询文档的位置? 例如:

db.users.find().sort({created:-1})

返回:

0: {name:"user1",created:5}
1: {name:"user1",created:4}
2: {name:"user1",created:3}
3: {name:"user1",created:2}

如何获取这些索引(0,1,2,3)?

0 个答案:

没有答案