If the command in the shell is:
db.runCommand({"distinct":"log", "key":"cs_uri_stem"});
I figure out that the corresponding C# code is :
var command = new CommandDocument {
{ "distinct", "log" },
{ "key", "cs_uri_stem"},
};
But how about the following command?
db.runCommand({"distinct":"log", "key":"cs_uri_stem", query:{ datetime: { $gt: new ISODate("2012-07-05T19:55:18.475Z"), $lt:new ISODate("2012-07-05T20:55:18.475Z")} }})
I can’t figure out how to do it in C#…
Thanks in advance!!
Also asked and answered at:
https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/TKZj_Qs0W5E
There’s actually a helper method in MongoCollection that you can use. Your second distinct command could be coded in C# like this: