When should I use cursor pagination?
For large collections (> 10000 docs) or infinite scroll. Cursor is fast because MongoDB uses an index on the cursor field. It is stable: new items do not cause duplicates or skips between requests.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Offset Pagination vs Cursor Pagination in MongoDB
Offset uses skip and limit; client can jump to any page; slow for large offsets. Cursor uses a cursor field (e.g., createdAt); client can only go next/prev; fast for large collections; stable when new items are inserted.
For small collections or when the client needs page numbers ('showing 1-20 of 432'). Offset is simple and lets the client jump to any page. Slow for large offsets because MongoDB scans the skipped docs.
MongoDB still scans the skipped documents before returning the ones you want. For offset 100000, it scans 100000 docs. Use cursor-based pagination instead: find documents where createdAt is less than the last cursor. MongoDB uses an index.
Still have questions?
Browse all our FAQs or reach out to our support team
