Mongo DB 4 - Instructions (Aggregation, Join)
Mongo DB(몽고 DB) 키워드로 공부하기 4
- 명령어 정리 Aggregation, Join
2023.04.19 - [Book & Lecture/Database] - Mongo DB 3 - Replication 및 Write&Read concerns
Aggregation 명령어
group
unwind
..
100% (durable)
$addToSet
array of unique expression values
$avg
average of numerical values
$first/$last value from the first or last document for each group $max/$min
highest or lowest expression value for each group
$mergeObjects document combined by input documents for each group $push
array of expression values for each group
$stdDevSamp
sample standard deviation of the input values
$sum
sum of numerical values
Join ($lookup)
mongoDB
SQL join !
More grouping ! $bucket
lookup
$bucketAuto
$facet
$sortByCount : pipeline [ $group {} , $sort {} ]
..
$set
Add extra fields without $projecting all of them $out
Write results to a new collection
$merge
Update an existing collection
$replaceRoot
Create a whole new shape of top-level document $sample
Choose a random set of docs from the input