luck_mylife

导航

 

//官方文档

https://docs.mongodb.com/manual/

 

http://www.tuicool.com/articles/2iqUZj

http://www.runoob.com/mongodb/mongodb-aggregate.html

http://www.cnblogs.com/AlvinLee/p/6085442.html

https://docs.mongodb.com/manual/reference/method/db.collection.distinct/

mongod.exe --dbpath C:\Environ\mongodb-3.0.7\data\db

http://www.cnblogs.com/ontheroad_lee/p/3756247.html

https://segmentfault.com/a/1190000004263347

 

          var group = new BsonDocument 
                { 
                    { "$group", 
                        new BsonDocument 
                            { 
                                { "_id", new BsonDocument { {"Age","$Age"} ,{"Sex","$Sex" } }},              
                                {"Count", new BsonDocument{ { "$sum", 1 } } }   
                            } 
                    } 
                };

            var pipeline = new[] { group };

            var result = collection.Aggregate(pipeline);

 

posted on 2017-03-07 23:08  二郎神  阅读(127)  评论(0编辑  收藏  举报