I'm trying to run this:
mongoexport.exe -h *MYHOST* -p *MYPORT* -q "{'time':{'$gte': ISODate('2014-12-21 12:57:00.506Z'),'$lt': ISODate('2014-12-21 12:59:00.506Z')}}"
Or this(the gte & lt without - ' ):
mongoexport.exe -h *MYHOST* -p *MYPORT* -q {'time':{$gte: ISODate('2014-12-21 12:57:00.506Z'),$lt: ISODate('2014-12-21 12:59:00.506Z')}}
The query works fine on Robomongo, But with mongoexport it throws: "too many positional arguments"
I know I can run the following instead, But I don't want to use the date converter everytime I need to execute a query.
mongoexport.exe -h *MYHOST* -p *MYPORT* -q "{'time':{$gte: new Date(14191
66620506),$lt: new Date(1419166740506)}}"
mongoexport queries require the use of strict-mode MongoDB extended JSON. You can read more about that flavor of extended JSON in the MongoDB Manual article on extended JSON. In your specific case, the proper way to write the first query in the mongoexport command is
mongoexport.exe -h *MYHOST* -p *MYPORT* -q "{ 'time' : { '$gte' : { '$date' : '2014-12-21 12:57:00.506Z' },'$lt' : { '$date' : '2014-12-21 12:59:00.506Z' } } }"