How to show latest records from MongoDb(c#) using DateTime column in a WPF Datagrid

1,007 views
Skip to first unread message

Rama krishna boyina

unread,
Mar 30, 2012, 1:57:54 AM3/30/12
to mongodb-user
Hi,

I have a WPF Datagrid.I am binding that grid to a table from
MongoDB(c#).
In that table DateTime column is there.
I want to show latest records first.
how to do?

Thanks,
Ramki

Asoka Sampath Edussooriya

unread,
Mar 30, 2012, 2:11:52 AM3/30/12
to mongod...@googlegroups.com
you can use a query to select the records db.collection.find().sort({_id:-1}) for descending order  

Asoka


--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.




--
Asoka Sampath Edussooriya

Rama krishna boyina

unread,
Mar 30, 2012, 2:19:49 AM3/30/12
to mongod...@googlegroups.com
Hi,
Thanks for your suggestions.
I tried that query but i am not getting sort.
i am getting SetSortOrder.
check my query.

var cursor = rskTable.Find(query).SetSortOrder(sort).Skip(filter.Skip).Take(filter.Take);



Thanks,
Rama Krishna,



Asoka Sampath Edussooriya

unread,
Mar 30, 2012, 2:32:59 AM3/30/12
to mongod...@googlegroups.com
Please go through the below link. it will be helpful you


Thanks!

Asoka

Rama krishna boyina

unread,
Mar 30, 2012, 2:34:46 AM3/30/12
to mongod...@googlegroups.com
k....I will try.

Thanks
Reply all
Reply to author
Forward
0 new messages