MongoDB 8 · Create, read, update, delete

Sort and paginate

Return the 10 newest documents, skipping the first 20.

db.users.find().sort({ createdAt: -1 }).skip(20).limit(10)

Official MongoDB 8 documentation

More create, read, update, delete commands

All create, read, update, delete commands · MongoDB 8 cheatsheet

Was this page helpful?