mongodump -q help with json date range?

1,572 views
Skip to first unread message

Steve

unread,
Dec 21, 2010, 2:34:58 PM12/21/10
to mongodb-user
i want to dump the month of december in thru mongodump. this is not
working.... We want gte beginning of December 2010, lte end of
December 2010.

mongodump -d out_db -c page_views -o page_views_december -q
'{"created_at" : {"$gte" : {"$date" : 1291190400}, "$lte" : {"$date" :
1293868799}}}'

Andreas Jung

unread,
Dec 21, 2010, 2:41:32 PM12/21/10
to mongod...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


http://cookbook.mongodb.org/patterns/date_range/

- -aj
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQGUBAEBAgAGBQJNEQLsAAoJEADcfz7u4AZjqeILwK4GmrhUpRLhJquwp+GX8bG5
OycocFXw0LmbWw5eC37dvC7UjGlj1ogc5fX2iL6tReeKRoWt2z7JeLfgDLd4nHMw
zRSFkUH65grUy635i1JsO6igTCoh0zgmm65dhS1ft+Nlgw+CLr8UzWvYL9WzaLt3
+kBGcKd/iZm8HaIRC7d0ASzh3wG8HiOFOoHPcYAvmSQv8DOhJnSPxASOQfX0K8t0
hjrDA5iQErL6zA1mQ/0mhmTq38quZEoSloND2f6NMyhG1v0rmj0DP9gP6HmVjhzC
nHGVcEt3rxHa3xtqUbvjoxst2C8ci5ihmrbjEahMBOTQ+jW1AAbFy4zFHKHsHNb/
WNWf0CkLcakrl9MxRpxdAB35WePCDk2pdZmBM3sWGsXExp5RLCeu/PXSO0qcSeBF
TFOHsJOlraLLRypxJZt7709/5JC3pQuEg1hlsOTpuTO9c7NhFQ8QAFE67THqzgO7
DNtZD1NgYGcG6PKfeNuKo7w+EoKaD+E=
=EYdd
-----END PGP SIGNATURE-----

lists.vcf

Steve

unread,
Dec 21, 2010, 2:51:27 PM12/21/10
to mongodb-user
Thanks Andreas, this works great in the mongo shell, but not as a JSON
query input to mongodump. that's the essence of the problem.


On Dec 21, 11:41 am, Andreas Jung <li...@zopyx.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Steve wrote:
> > i want to dump the month of december in thru mongodump.  this is not
> > working....  We want gte beginning of December 2010, lte end of
> > December 2010.
>
> >      mongodump -d out_db -c page_views -o page_views_december -q
> > '{"created_at" : {"$gte" : {"$date" : 1291190400}, "$lte" : {"$date" :
> > 1293868799}}}'
>
> http://cookbook.mongodb.org/patterns/date_range/
>
> - -aj
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (Darwin)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> iQGUBAEBAgAGBQJNEQLsAAoJEADcfz7u4AZjqeILwK4GmrhUpRLhJquwp+GX8bG5
> OycocFXw0LmbWw5eC37dvC7UjGlj1ogc5fX2iL6tReeKRoWt2z7JeLfgDLd4nHMw
> zRSFkUH65grUy635i1JsO6igTCoh0zgmm65dhS1ft+Nlgw+CLr8UzWvYL9WzaLt3
> +kBGcKd/iZm8HaIRC7d0ASzh3wG8HiOFOoHPcYAvmSQv8DOhJnSPxASOQfX0K8t0
> hjrDA5iQErL6zA1mQ/0mhmTq38quZEoSloND2f6NMyhG1v0rmj0DP9gP6HmVjhzC
> nHGVcEt3rxHa3xtqUbvjoxst2C8ci5ihmrbjEahMBOTQ+jW1AAbFy4zFHKHsHNb/
> WNWf0CkLcakrl9MxRpxdAB35WePCDk2pdZmBM3sWGsXExp5RLCeu/PXSO0qcSeBF
> TFOHsJOlraLLRypxJZt7709/5JC3pQuEg1hlsOTpuTO9c7NhFQ8QAFE67THqzgO7
> DNtZD1NgYGcG6PKfeNuKo7w+EoKaD+E=
> =EYdd
> -----END PGP SIGNATURE-----
>
>  lists.vcf
> < 1KViewDownload
Message has been deleted

Kristina Chodorow

unread,
Dec 21, 2010, 6:54:58 PM12/21/10
to mongod...@googlegroups.com
Steve: Andreas' answer quotes the relevant mongodump option.


On Tue, Dec 21, 2010 at 6:51 PM, Nat <nat....@gmail.com> wrote:
Try some query like http://jira.mongodb.org/browse/SERVER-641




 mongodump -d out_db -c page_views -o page_views_december -q
'{"created_at" : {"$gte" : {"$date" : 1291190400}, "$lte" :
{"$date" :
1293868799}}}'

--
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.


Alvin Richards

unread,
Dec 21, 2010, 10:37:17 PM12/21/10
to mongodb-user
Steve,

They key is to get the epoch times correct

mongodump ... -q '{"created_at" : { "$gte" : {"$date" :
1293868800000}, "$lt" : {"$date" : 1296460800000}}}'

-Alvin


On Dec 21, 3:54 pm, Kristina Chodorow <krist...@10gen.com> wrote:
> Steve: Andreas' answer quotes the relevant mongodump option.
>
>
>
> On Tue, Dec 21, 2010 at 6:51 PM, Nat <nat.lu...@gmail.com> wrote:
> > Try some query likehttp://jira.mongodb.org/browse/SERVER-641
> > mongodb-user...@googlegroups.com<mongodb-user%2Bunsubscribe@google groups.com>
> > .

Alvin Richards

unread,
Dec 21, 2010, 10:41:06 PM12/21/10
to mongodb-user
Reply all
Reply to author
Forward
0 new messages