2
나는 다음과 같은 집계 쿼리가 있습니다
{"$match": {"expired":{"$exists":False}}},
{"$group":{
"_id":"$retailer",
"average_price": {"$avg":"$price"},
"highest_price": {"$max":"$price"},
"lowest_price": {"$min":"$price"},
"online": {"$sum":1}
}}
내가 홍보에 얼마나 많은 제품을 계산하여이를 확장하고자합니다. 나는 이것을 시도했다. (분명히 유효하지 않다) :
{"$match": {"expired":{"$exists":False}}},
{"$group":{
"_id":"$retailer",
"average_price": {"$avg":"$price"},
"highest_price": {"$max":"$price"},
"lowest_price": {"$min":"$price"},
"online": {"$sum":1},
"promomtion": {"$sum":{"promotion":True}},
}}
이 쿼리 내에서이 프로모션 카운트를 계산할 방법이 있습니까?
을 투사'promotion_c : {$ 콘드는 : [{$ EQ : { '$ 추진'사실}} 1,0]}'다음'promotion_c'을 요약 – Sammaye