如果没有数字行索引,如何在MongoDB上多次第二次批量查询(跳过)

时间:2021-02-22 21:39:05

Usually I did this

通常我这样做了

db.flat_transaction.find({},{"customer_id": 1,"item": 1, "_id":0}).limit(3000000)

db.flat_transaction.find({},{“customer_id”:1,“item”:1,“_ id”:0})。limit(3000000)

But, I want to query the 3000001-6000000 entry , 6000001-9000000entry, etc.

但是,我想查询3000001-6000000条目,6000001-9000000entry等。

How suppose I do this?

我怎么想这样做?

2 个解决方案

#1


1  

Use MongoDB Skip

使用MongoDB Skip

db.flat_transaction.find({},{"customer_id": 1,"item": 1, "_id":0}).skip(3000000).limit(3000000)

#2


1  

Could cursor.skip() be something you could use?

你可以使用cursor.skip()吗?

It allows you to skip x-number of elements before MongoDB starts to return results

它允许您在MongoDB开始返回结果之前跳过x个元素

https://docs.mongodb.com/manual/reference/method/cursor.skip/

#1


1  

Use MongoDB Skip

使用MongoDB Skip

db.flat_transaction.find({},{"customer_id": 1,"item": 1, "_id":0}).skip(3000000).limit(3000000)

#2


1  

Could cursor.skip() be something you could use?

你可以使用cursor.skip()吗?

It allows you to skip x-number of elements before MongoDB starts to return results

它允许您在MongoDB开始返回结果之前跳过x个元素

https://docs.mongodb.com/manual/reference/method/cursor.skip/