본문 바로가기
Book & Lecture/Database

Mongo DB 4 - Instructions (Aggregation, Join)

by Dev Diary Hub 2024. 5. 12.
반응형

Mongo DB(몽고 DB) 키워드로 공부하기 4

 - 명령어 정리 Aggregation, Join

$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

 

반응형