Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $lookup:{
- from:"reviewlocations",
- localField:"_id",
- foreignField:"id_location",
- as: "list_rating"
- }
- $project:{
- "rating_all":{
- $avg: "$list_rating.rating"
- }
- }
- if(result[i].rating_all == null){
- result[i].rating_all = "0"
- }else{
- result[i].rating_all = String(result[i].rating_all)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement