Query to display all objects where timestamp greater than particular date
3,706 views
Skip to first unread message
sanmukho
unread,
Apr 26, 2011, 3:16:53 AM4/26/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
Hi
Will the below query work, if not then how to write "show me all
values where timestamp greater than particular date"
db.user.find( { timestamp :{$lt : Date() } } )
db.user.find( { timestamp :{$gt : Date() } } )
Thanks
Sandy
Chris Westin
unread,
Apr 26, 2011, 11:59:54 AM4/26/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
That example will query against "now," which probably isn't what you
want. But yes, you can do date range queries. See the How To article
here: http://cookbook.mongodb.org/patterns/date_range/ .
Chris
sanmukho
unread,
Apr 27, 2011, 8:30:35 AM4/27/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message