db.collection.find()
db.collection.find({ field: value })
$and
나 $or
연산자를 사용하여 여러 조건을 결합하여 검색할 수 있습니다.
db.collection.find({ $and: [ { field1: value1 }, { field2: value2 } ] })
$gt
(크다), $lt
(작다), $gte
(크거나 같다), $lte
(작거나 같다), $ne
(같지 않다) 등의 비교 연산자를 사용하여 범위를 지정할 수 있다.
db.collection.find({ age: { $gt: 18 } })
db.collection.find({ field: /keyword/ })
db.collection.find({ field: /키워드/i })
db.collection.find({ tags: { $in: ["tag1", "tag2"] } })
db.collection.find({ $text: { $search: "keyword" } })
db.collection.find().sort({ field: 1 })
db.collection.find().limit(10)
다음 MongoDB Query and Projection Operators에서 다양한 연산자를 찾아볼 수 있다.