I am running a find command (using node) against my mongodb Atlas cluster. The query is supposed to return in the neighborhood of 1.3 mil records. But I get this error:
RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 && <= 17825792. Received 17825801
at Buffer.write (buffer.js:1052:5)
...
...
Here is my code:
LeadDeliveryLog.find(query)
.populate('lead', '-_id fname lname email phone city state zip ip')
.lean()
.then(leads => {
console.log('Done', leads.length);
})
.catch(e => {
console.log('---------------ERROR--------------');
console.log(e);
})
From what I understand, that error is thrown when you try to insert a document larger than 16M into your database. But I am not doing that. I am just running a find command. What am I missing here?