MONGODB QUERY
MongoDB 조회는 문서 경로와 인덱스가 같이 움직인다
점 표기법으로 중첩 필드를 찾고, 필요한 경우 집계 파이프라인으로 문서를 단계별로 변환한다.
FilterIndexPipeline
db.orders.find({
"user.id": 1001,
total: { $gte: 100000 }
})
db.orders.aggregate([
{ $match: { status: "shipped" } },
{ $group: { _id: "$user.id", total: { $sum: "$total" } } },
{ $sort: { total: -1 } }
])