I'm trying to run a mongoexport with the following query:
var d = new Date();
d.setMonth(d.getMonth() - 3);
db.GameHistory.find( { timeCreated: { $lte: d} } )
I want to export all documents with creation Date older then 3 month. I tried this:
mongoexport --db game_server --collection GameHistory -q ' var d = new Date();d.setMonth(d.getMonth() - 3);db.GameHistory.find( { timeCreated: { $lte: d} } )' --out /home/dev/file.json
and got this exception:
assertion: 16619 code FailedToParse: FailedToParse: Expecting '{': offset:0 of:db.GameHistory.find( { timeCreated: { $lte: new Date()} } )
Ideas?