There are 300 records in my mongoDB, and I do the querying with the following code :
Criteria c = ...;
Query q = new Query(c).limit(10).skip(skip);
q = q.with(new Sort(Sort.DEFAULT_DIRECTION.DESC,"fromDate"));
List<Event> results = mongoTemplate.find(q, Event.class, "Event");
When skip = 40, this code works fine.
However, when skip = 260, I get the following error:
Overflow sort stage buffered data usage of 33564943 bytes exceeds internal limit of 33554432 bytes;
It seems that mongoDB has overflow problem when sorting with large amount of records. Can anyone suggest how to deal with this issue?