Mongodb cursor with distinct

172 views
Skip to first unread message

Satyam

unread,
Sep 2, 2014, 4:33:18 AM9/2/14
to mongod...@googlegroups.com
Hi All

I want to use distinct keyword with mongocursor like below. Can any one help on this ??

MongoCursor<GetDetails> gdResult = gdDataCollection.Find(Query.EQ("Found", "Yes")).Distinct("Name");

Satyam


Will Berkeley

unread,
Sep 3, 2014, 2:18:33 PM9/3/14
to mongod...@googlegroups.com
The Distinct method is a method on a MongoCollection that returns an IEnumerable over the distinct values. It can't be applied to a MongoCursor, such as is returned from MongoCollection.Find, and it doesn't return a MongoCursor. You can't use it like you're trying to in that code snippet.

-Will
Reply all
Reply to author
Forward
0 new messages