mongoexport query help

80 views
Skip to first unread message

Michael Earle

unread,
Jul 4, 2014, 6:12:19 AM7/4/14
to mongod...@googlegroups.com
Hi,

I have a mongodb collection that I've been exporting data from the data is getting to be a lot so the old way where I pull it in to excel and filter it is slowly becoming an option I don't have (too many rows), I'm trying to build a query in mongoexport that will look at a guid and a time field (Unix Epoch w/ milliseconds) and only export the most recent data according to that guid, I am however terrible at figuring this kind of stuff out, can anyone here point me in the right direction to figure this out or give me a hand and kinda walk me through this?

I would really appreciate it.

Thank you,
Michael

Joe Wagner

unread,
Jul 4, 2014, 1:15:20 PM7/4/14
to mongod...@googlegroups.com
Hey Michael,

If I want all of the documents with a timestamp newer than June 1st, the following works for me when I substitute in my db collection and timestamp field names

mongoexport -db yourdb -c yourcollection -q '{ yourTimestampField: { $gt: new Date(1401602400000) }}'

I'm not sure how you are using the guid, but I hope the above is helpful
-Joe
Reply all
Reply to author
Forward
0 new messages