일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- openCV
- Artificial Intelligence
- 인공지능
- Deep learning
- 확률
- node.js
- 통계
- 주일설교
- 김양재
- Statistics
- 빅 데이타
- c++
- 김양재 목사님
- 빅데이타
- 김양재 목사
- data science
- 우리들교회
- nodeJS
- 데이터 과학
- MongoDB
- Machine Learning
- 빅데이터
- Big Data
- R
- 몽고디비
- 딥러닝
- WebGL
- probability
- 빅 데이터
- No SQL
Archives
- Today
- Total
Scientific Computing & Data Science
[MongoDB] Query / $all 본문
by Geol Choi |
우선 다음과 같이 "food" 컬렉션에 array 타입으로 도큐먼트를 추가한다:
> db.food.drop()
> db.food.insert({"_id" : 1, "fruit" : ["apple", "banana", "peach"]})
> db.food.insert({"_id" : 2, "fruit" : ["apple", "kumquat", "orange"]})
> db.food.insert({"_id" : 3, "fruit" : ["cherry", "banana", "apple"]})
"apple"과 "banana" 모두를 포함하는 도큐먼트는 ID 1과 ID 3이다.
"$all"을 통해 이 두 가지 모두를 포함하는 도큐먼트를 검색해 보자.
> db.food.find({fruit : {$all : ["apple", "banana"]}})
{ "_id" : 1, "fruit" : [ "apple", "banana", "peach" ] }
{ "_id" : 3, "fruit" : [ "cherry", "banana", "apple" ] }
예상대로 ID 1과 3이 검색 되었다.
'Data Science > MongoDB' 카테고리의 다른 글
[MongoDB] Query / $slice (0) | 2014.02.01 |
---|---|
[MongoDB] Query / $size (1) | 2014.02.01 |
[MongoDB] Query / find (0) | 2014.02.01 |
[MongoDB] Update Modifiers / Part 9. - findAndModify (0) | 2014.01.31 |
[MongoDB] Update Modifiers / Part 8. - Updating Multiple Documents (0) | 2014.01.30 |