I am new to music play. I want to export some data for the last hours from my databases. So it seems to me that I need to write the mongoexport command and include the date range in --query for this.
I am writing a bash file like this and trying to run it:
#!/bin/bash mongoexport --host localhost:27017 --db copy --collection txt --csv --fields x1,x2,x3...,date --query '{ "date" : {$gt:new Date(new Date() - 1000*60*60*3)} }' --out home/data.csv
But I get the results:
connected to: localhost:27017 assertion: 16619 code FailedToParse: FailedToParse: Expecting '}' or ',': offset:25 of:{ "date" : {$gt:new Date(new Date() - 1000*60*60*3)} }
It sees a connection to localhost , but cannot output data. If I remove the --query option, it may succeed and get all the data, but I need a query to subset the data for the last 3 hours.
Any ideas and help would be greatly appreciated. Thank you and you are better.
source share