mongodb中,对于一个大集合,如何做到每次只取一点,分段取完一个集合?
仅有的幸福
仅有的幸福 2017-04-25 09:02:22
0
1
804

集合的查询带条件的,条件可能会变,如果是mysql的话,可以通过简单记录ID来做到,以后取只取比这个id大的,但是mongodb不知道该如何做?

仅有的幸福
仅有的幸福

reply all(1)
某草草
  1. Like mysql, you can add a long-type redundant field, incrementing each time, so that you can solve the problem that the mongo primary key is of type ObjectId;
  2. You can use paging to do it, but you may need to record how much data has been fetched in previous segments. If the same amount of data is fetched in each segment, it is more suitable for paging.
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template