Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
mongodb日期查询JAVA和Talend_Java_Json_Mongodb_Talend - Fatal编程技术网

mongodb日期查询JAVA和Talend

mongodb日期查询JAVA和Talend,java,json,mongodb,talend,Java,Json,Mongodb,Talend,我一直在使用pymongo来完成我所有的mongodb交互,不过现在,我需要从Talend运行一个查询,而不必使用python 我直接对mongodb使用以下查询: db.votes.find({'dateUpdated': {$gte: (new Date(new Date().setDate(new Date().getDate()-5)))}}); 只要运行date组件,我就会得到一个5天的ISODate Talend使用JAVA,我无法在那里复制查询。我得到以下错误: {'dateUp

我一直在使用pymongo来完成我所有的mongodb交互,不过现在,我需要从Talend运行一个查询,而不必使用python

我直接对mongodb使用以下查询:

db.votes.find({'dateUpdated': {$gte: (new Date(new Date().setDate(new Date().getDate()-5)))}});
只要运行date组件,我就会得到一个5天的ISODate

Talend使用JAVA,我无法在那里复制查询。我得到以下错误:

{'dateUpdated': {$gte: (new Date(new Date().setDate(new Date().getDate()-5)))}}
                   ^
at com.mongodb.util.JSONParser.parse(JSON.java:198)
at com.mongodb.util.JSONParser.parseObject(JSON.java:231)
at com.mongodb.util.JSONParser.parse(JSON.java:195)
at com.mongodb.util.JSONParser.parseObject(JSON.java:231)
at com.mongodb.util.JSONParser.parse(JSON.java:195)
at com.mongodb.util.JSONParser.parse(JSON.java:145)
at com.mongodb.util.JSON.parse(JSON.java:81)
at com.mongodb.util.JSON.parse(JSON.java:66)
通过Talends UI生成的JAVA代码如下所示:

com.mongodb.DBObject myQuery_tMongoDBInput_1 = (com.mongodb.DBObject) com.mongodb.util.JSON
                    .parse("{'dateUpdated': {$gte: (new Date(new Date().setDate(new Date().getDate()-5)))}}");
我基本上对JAVA非常了解,但我希望有人能帮我在这个.parse函数中加入一些东西,让我的帖子更新日期超过5天

谢谢