$lte (Less Than or Equal)

Last updated: 2026-10-09

$lte (Less Than or Equal)

$lte selects documents where a field value is less than or equal to the specified value. `{ price: { $lte: 50 } }` matches products priced at most 50. It expresses at-most semantics and pairs with $gte to form a closed range — common for discounts and limits, and index-friendly.

CategoryComparison
MongoDB Version1.0+
Example Languagemongosh (Shell)

📝 Syntax

{ <field>: { $lte: <value> } }

⚙️ Parameters

fieldThe document field to match.
valueThe upper-bound value; the boundary itself is included.

Returns:Cursor of matching documents

▶ Example

Run the commands below in your local mongosh (requires a running mongod):

// $lte: products priced at most 50
db.products.find({ price: { $lte: 50 } })

// Closed range: qty from 1 to 10
db.orders.find({ qty: { $gte: 1, $lte: 10 } })

Output:

// Returns products at most 50 and orders with qty between 1 and 10

📌 Notes

📚 Related Tutorials

❓ FAQ

QCan $lte filter dates up to today?
AYes, compute the end-of-day in code: { createdAt: { $lte: new Date('2026-09-30T23:59:59') } }.
QWhat is the difference between $lte and $lt?
A$lte includes equality; $lt is strictly less. Use $lte: 50 for at most 50.
QHow do I query qty between 1 and 10?
A{ qty: { $gte: 1, $lte: 10 } } — both ends inclusive.
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%

🙏 帮我们做得更好

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

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