$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.

CategoryProjection
MongoDB Version1.0+
Example Languagemongosh (Shell)

📝 Syntax

{ $natural: <1 or -1> }

⚙️ Parameters

direction1 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

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.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏