티스토리 뷰

데이터베이스/MongoDB

and 조건 검색 예시

기록하자 2024. 8. 29. 18:01

db.getCollection("quiz3").find({

$expr : { "$and" : [

{$ne : ["$status.code", "999"]},

{$lte : [{$strLenCP : "$title"}, 26]},

{$eq : ["$format.type", "TEXT"]},

{$eq : ["$format.answerType", "MULTIPLE_CHOICE"]},

{$allElementsTrue : {$map : {

"input" : "$examples.body", "in" : {"$lte": [{"$strLenCP" : "$$this"}, 6]}

}}}

]

}}).limit(1000);

status 999 and title 길이가 26 이하이고 format.type 이 TEXT이고 format answerType 이 MULTIPLE_CHOICE 이고 example 배열에 json 값 중 body 의 텍스트 길이가 6 이하인 조건 검색

'데이터베이스 > MongoDB' 카테고리의 다른 글

[업데이트] document 데이터 일부 업데이트 하기  (0) 2020.10.26
MongoDB 검색 방법  (0) 2020.02.11
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함