MongoDB CRUD for Documents/Find documents with a filter

Return all matching documents.

Section: Create and read

Find documents with a filter

javascript
javascript
db.products.find({ in_stock: true, price: { $lt: 100 } })
Explanation

Filters use MongoDB query operators such as `$lt`, `$gt`, `$in`, and `$exists`.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Create and read
Insert one document
Create a single document.
OpenIn sheetjavascriptsame section
Insert many documents
Create multiple documents in one call.
OpenIn sheetjavascriptsame section
Find one matching document
Return a single document by filter.
OpenIn sheetjavascriptsame section
Count matching documents
Count documents for a specific filter.
OpenIn sheetjavascriptsame section
Update one document with $set
Modify selected fields without replacing the whole document.
OpenIn sheetjavascript1 tag match
Update many documents
Apply one change to many matching documents.
OpenIn sheetjavascript1 tag match