2014년 12월 27일 토요일

how to group by and count using Mongodb c# driver

i want to  "select col1 ,count(*) from table1 group by col1" in mongodb. how can i write?

i try to write this,but it's fail.

var query 
    = from e in collection.AsQueryable<table1>()
       group e by e.col1 into g
       select new {g.Key,g.Count()}


the driver is not suported the "group by ",how can i do,please



I found this and thought it might help.


It is around 2 years old, but I think enough still holds true.



thank you very much,i think it will help me.i will try it in monday



Check out MongoLinqPlusPlus, a Linq provider for MongoDB's aggregation framework: https://bitbucket.org/tomAdomic/mongolinqplusplus

It was written to support exactly this kind of query.


댓글 없음:

댓글 쓰기