skip()

Reference type:Cheat sheetFormat:Syntax + example + use case

Reference group: Cursor methods

What it does

Skips the first N results.

Syntax

cursor.skip(n)

Use case

Simple offset pagination.

Important notes

Large offsets can be expensive; consider range pagination.

skip(): practical example
db.products.find({ active: true }).sort({ _id: 1 }).skip(100).limit(20)
💡 Explanation Skips the first N results. When to use it Simple offset pagination. Caution Large offsets can be expensive; consider range pagination.
Key Takeaways
  • Skips the first N results.
  • Typical use: Simple offset pagination.