On 08/05/17 13:38, Chetan Mehrotra wrote:
On Mon, May 8, 2017 at 5:01 PM, <[email protected]> wrote:
- DBObject sortFields = new BasicDBObject(NodeDocument.MODIFIED_IN_SECS,
-1);
+ DBObject sortFields = new BasicDBObject(NodeDocument.MODIFIED_IN_SECS,
1);
May be we skip sorting altogether. In that case iteration would be on
id which should be stable order.
The _id index is not appropriate for this kind of query. The query is
for documents that have been modified after a given timestamp. In almost
all cases MongoDB will use the _modified+_id compound index. I wanted to
leave the sort in there to make sure MongoDB scans the index in the
correct sequence.
Regards
Marcel