如何使用复杂查询进行mongoexport

时间:2014-08-10 13:50:44

标签: mongodb mongoexport

我尝试使用以下查询运行mongoexport:

var d = new Date();
d.setMonth(d.getMonth() - 3);
db.GameHistory.find( { timeCreated: { $lte: d} } )

我想导出所有文件的创建日期早于3个月。 我试过这个:

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

并得到了这个例外:

assertion: 16619 code FailedToParse: FailedToParse: Expecting '{': offset:0 of:db.GameHistory.find( { timeCreated: { $lte: new Date()} } )

想法?

0 个答案:

没有答案