MongoDB aggregation with $match $skip $limit and order guarantee

Does the following aggregation guarantee a default ordering for the documents assuming that the $match returns unique documents? Or we always have to include a sort step to have consistent results across pages?

db.collection.aggregate([
   {$match:{...}},
   {$skip:700},
   {$limit:100}
]}

If you want a specific order you must sort.

I don’t need a specific order.

You asked for

This is specific since you want

You must sort to have consistent results.

If you don’t include the $sort stage, the results will be returned in the order they are found (natural order). That does not guarantee that the order will be the same every time.

If you want the consistent order of the results, you have to include $sort stage, as @steevej already mentioned.

Since you don’t need any specific sort, I suggest you to sort based on the _id field since it’s indexed by default.

For more details and a comprehensive explanation, you can check this answer on StackOverflow.