I'm sure it can[1], do you mean can you get documents in insertion order? The default _id is a random right-leaning identifier[2], so sorting by it would only get you an approximate insertion order (except in a deployment with a single server). However as the linked documentation demonstrates you could supply a strictly incrementing ID, if your architecture abides.
no, that means you can sort on a max of 32 fields per sort request, like fieldOne, fieldTwo, fieldThree...
There's no limit on number of sortable documents. Use an index to sort and it'll also be fast and use no extra memory. If you want to do an in memory sort there are memory limits, but you can also tell it to overflow to disk.
maxbond|2 years ago
[1] https://www.mongodb.com/docs/manual/reference/operator/aggre...
[2] https://www.mongodb.com/docs/manual/reference/method/ObjectI...
winrid|2 years ago
There's no limit on number of sortable documents. Use an index to sort and it'll also be fast and use no extra memory. If you want to do an in memory sort there are memory limits, but you can also tell it to overflow to disk.