On a collection with over 100k records, when I query with Mongoose options like so:
contact.find({}, {}, {
collation: {
locale: 'en_US',
strength: 1
},
skip: 90000,
limit: 10,
sort: {
email: 1
}
});
I get this error:
MongoError: Executor error during find command: OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.
But I do have an index on the email field:
{
"v" : 2,
"key" : {
"email" : 1
},
"name" : "email_1",
"ns" : "leadfox.contact",
"background" : true
}
On the other hand when I query in the Mongo shell it works fine:
db.contact.find().sort({email: 1}).skip(90000).limit(10)