I have MongoDB collection that have 5 documents, which I am running a query against it. The query fetches one document at a time.
the first 2 fetches return the expected result, while the last 3 fetches are fetching the third document only, while the last and second last documents are not being fetched at all.
Notice the last three documents have the same id.
db.A.find({}).limit(1).skip(0).sort({“startDate”: 1});
{ “_id” : ObjectId(“61097e72e0903145c925e445”)
db.A.find({}).limit(1).skip(1).sort({“startDate”: 1});
{ “_id” : ObjectId(“61098839ddd36878ba1acfef”)
db.A.find({}).limit(1).skip(2).sort({“startDate”: 1});
{ “_id” : ObjectId(“6112f90c5d7fc9e3ad1385ee”)
db.A.find({}).limit(1).skip(3).sort({“startDate”: 1});
{ “_id” : ObjectId(“6112f90c5d7fc9e3ad1385ee”)
db.A.find({}).limit(1).skip(4).sort({“startDate”: 1});
{ “_id” : ObjectId(“6112f90c5d7fc9e3ad1385ee”)