In mongodb, for a large set, how do you take only one point at a time and complete one set in segments?

  mongodb, question

If the query of the collection is conditional, the condition may change. If it is mysql, it can be done by simply recording the id. In the future, only the ID larger than this ID will be taken, but mongodb does not know how to do it.

  1. Like mysql, you can add a long redundant field and increment it every time, which can solve the problem that mongo primary key is ObjectId type.
  2. Pagination can be used, but it may be necessary to record how much data has been taken by the segmentation before. If each segment takes the same amount of data, it is more suitable for paging le.