DDCODE

Share programming skills from Magic Oriental

In the example of aggregate in MongoDB official documents, $sum: 1, what does 1 do here?

 May 12, 2019   mongodb, question
db.restaurants.aggregate(
 [
 { $match: { "borough": "Queens", "cuisine": "Brazilian" } },
 { $group: { "_id": "$address.zipcode" , "count": { $sum: 1 } } }
 ]
 );

http://docs.mongodb.org/manual/reference/operator/aggregation/sum/

Summing 1 by expression value means 1

<< Mongodb Embedded Document Query Mongo storage space problem >>

Powered by MyWiki WordPress Theme