No problem. The driver doesn't have many convenience methods yet such as for sorting. You have to format the proper query yourself and send it to one of the find methods.
db.collection.find().sort({name:1, age:-1}); in the shell issues this query to the database:
{ query: {}, orderby: { name:1.0, age:-1.0} }
Every {} pair is another document so the equivalent c# code would be:
db["collection"].Find(new Document().Append("query", new Document()).Append("orderby", new Document().Append(name:1).Append(age,-1)));
It is a little long but for now that is the way you have to do it. After some more of the major features on the todo list are out of the way I'll be circling around and adding some more of the convenience methods.
-Sam
P.S. I hope you don't mind. I cc'ed the list so that others can find the answer later.
On Thu, Jan 7, 2010 at 5:32 PM, Okku Touronen
<> wrote:
Hello Sam, I have been using your mongodb driver and like it a lot.
Sorry for this silly question: How do I use it for sorting?
Like this:
db.collection.find().sort({name : 1, age : -1})
Best regards Okku Touronen