-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.8.2
-
Component/s: Query Operations
-
None
These two queries return a different result (executed in the mongo shell):
1. This one doesn't consider _id at all. Hence returns incorrect results.
db.EntityById.find(\{'storageContainerId':'DefaultStorageContainer','bucketId':'29E31FCB56AB3E3B7F000101'})
2. This one returns proper results.
db.EntityById.find(\{'storageContainerId':'DefaultStorageContainer','bucketId':'29E31FCB56AB3E3B7F000101'}) .limit(5) .sort(\{'sortField':1, '_id':1}) .min(\{ "sortField" : 'test', "_id" : new ObjectId("5d402ea15978f845d2218803")});
We're using below piece of code to generate .min() part of above query:
findIterable.min( *new* BsonDocument().append(sortBy,*new* BsonString(sortField)) .append(MongoConstants.*_ID_FIELD_*, *new* BsonObjectId(*new* ObjectId("5d402ea15978f845d2218803"))));
Any changes I can make to fix my code to generate _id as 'new ObjectId("<>")' in the resulting query?
We're currently blocked on this. Please help.