$natural (Physical Storage Order)
Last updated: 2026-10-09
$natural (Physical Storage Order)
$natural returns documents in the collection's physical storage order. `{ $natural: 1 }` forward, `{ $natural: -1 }` reverse. Especially useful on capped collections and for diagnostics. Note that $natural cannot be combined with index-using queries — it explicitly requests a natural collection scan.
| Category | Projection |
|---|---|
| MongoDB Version | 1.0+ |
| Example Language | mongosh (Shell) |
📝 Syntax
{ $natural: <1 or -1> }
⚙️ Parameters
| direction | 1 for forward, -1 for reverse. |
|---|
Returns:Documents in physical storage order
▶ Example
Run the commands below in your local mongosh (requires a running mongod):
// $natural: logs in storage order
// For capped collections this is write order
db.logs.find().sort({ $natural: -1 })
// Forward order, first 10
db.logs.find().sort({ $natural: 1 }).limit(10)
Output:
// Returns logs in reverse order (newest first); the second query takes the first 10 forward
📌 Notes
- Order is not stable long-term; compaction or migration changes it
- Can replace _id ordering on capped collections
- Mutually exclusive with index-using queries
🏷️ Related Tags
💡 Related Cases
More hands-on cases coming soon.
📚 Related Tutorials
❓ FAQ
QWhat order does $natural use?
AThe collection's physical storage order, usually close to insertion order but not guaranteed.
QCan $natural use an index?
ANo, it is an index-free natural scan by design.
QWhen should I use $natural?
AFor capped-collection logs and diagnostics.