Working with Data
Sorting and Pagination
Sort results and navigate large datasets efficiently
Sorting and Pagination
Efficiently navigate and organize large MongoDB collections with sorting and pagination.
Sorting Documents
Single Field Sort
Click any column header to sort by that field:
- First click: Ascending order
- Second click: Descending order
- Third click: Remove sort
Multi-Field Sort
Sort by multiple fields in order of priority:
- Hold
Shiftand click column headers - First clicked column is primary sort
- Additional columns are secondary sorts
Sort Syntax
When using the query editor, specify sort with MongoDB syntax:
// Sort by name ascending
{ "name": 1 }
// Sort by age descending, then name ascending
{ "age": -1, "name": 1 }
Pagination
Page Size
Choose how many documents to display per page:
- 25 - Quick loading, frequent paging
- 50 - Balanced (default)
- 100 - Fewer page loads
- Custom - Specify your own limit
Smaller page sizes load faster but require more navigation. Choose based on your workflow.
Navigation Controls
Navigate through pages using:
- Next/Previous buttons
- Page number input
- Keyboard shortcuts (
←/→)
Virtual Scrolling
For very large result sets, enable virtual scrolling:
- Go to View Settings
- Enable Virtual Scrolling
- Scroll smoothly through thousands of documents
Virtual scrolling works best with indexed queries. Unindexed scans may be slow.
Performance Best Practices
- Use indexes on sorted fields
- Limit result sets with filters before sorting
- Avoid sorting on large text fields
- Use compound indexes for multi-field sorts