<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic tMongoInput Query Parse Error in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/tMongoInput-Query-Parse-Error/m-p/2324959#M94605</link>
    <description>&lt;P&gt;i am trying to few records from mongodb collection using below mongo query which is running fine in mongo console or studio3t.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;"{&lt;BR /&gt;begin_date : {&lt;BR /&gt;$gte: new Date(new Date().setDate(new Date().getDate()-30))&lt;BR /&gt;}&lt;BR /&gt;}"&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;But it giving the error as&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;Exception in component tMongoDBInput_3 (All_Tables)
org.bson.json.JsonParseException: JSON reader expected an integer or a string but found 'new'.
	at org.bson.json.JsonReader.visitDateTimeConstructor(JsonReader.java:923)
	at org.bson.json.JsonReader.visitNew(JsonReader.java:554)&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Any help.&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2019 13:34:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-05-22T13:34:54Z</dc:date>
    <item>
      <title>tMongoInput Query Parse Error</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMongoInput-Query-Parse-Error/m-p/2324959#M94605</link>
      <description>&lt;P&gt;i am trying to few records from mongodb collection using below mongo query which is running fine in mongo console or studio3t.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;"{&lt;BR /&gt;begin_date : {&lt;BR /&gt;$gte: new Date(new Date().setDate(new Date().getDate()-30))&lt;BR /&gt;}&lt;BR /&gt;}"&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;But it giving the error as&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;Exception in component tMongoDBInput_3 (All_Tables)
org.bson.json.JsonParseException: JSON reader expected an integer or a string but found 'new'.
	at org.bson.json.JsonReader.visitDateTimeConstructor(JsonReader.java:923)
	at org.bson.json.JsonReader.visitNew(JsonReader.java:554)&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Any help.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 13:34:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMongoInput-Query-Parse-Error/m-p/2324959#M94605</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-22T13:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: tMongoInput Query Parse Error</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMongoInput-Query-Parse-Error/m-p/2324960#M94606</link>
      <description>&lt;P&gt;The are a lot of existing threads on this subject,&amp;nbsp; did you see this one:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;A href="https://community.qlik.com/s/feed/0D73p000004kGc8CAE#M23414" target="_blank"&gt;https://community.talend.com/t5/Design-and-Development/Selecting-data-from-MongoDB/m-p/61270/highlight/true#M23414&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The author in the comment says this syntax worked, for example, to get all records where&amp;nbsp;lastModifiedDate is gte now:&lt;/P&gt; 
&lt;PRE&gt;"{lastModifiedDate:&lt;BR /&gt;{$gte:{$date:'"+TalendDate.formatDate("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",new java.util.Date())+"' &lt;BR /&gt;}}}"&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 06:30:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMongoInput-Query-Parse-Error/m-p/2324960#M94606</guid>
      <dc:creator>nfz11</dc:creator>
      <dc:date>2019-05-23T06:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: tMongoInput Query Parse Error</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMongoInput-Query-Parse-Error/m-p/2324961#M94607</link>
      <description>&lt;P&gt;Thanks for the reply&amp;nbsp;&lt;A href="https://community.qlik.com/s/profile/00539000006yqfZAAQ"&gt;@nfz11&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did tried what you given.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it's not returning any rows.&lt;/P&gt;
&lt;PRE&gt;[statistics] connecting to socket on port 3702
[statistics] connected
[statistics] disconnected&lt;/PRE&gt;
&lt;PRE&gt;"{
begin_date:
{
$gte:{$date:'"+TalendDate.formatDate("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",new java.util.Date())+"' }
}
}"&lt;/PRE&gt;
&lt;P&gt;And how do i can get previous day records from the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 May 2019 06:21:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMongoInput-Query-Parse-Error/m-p/2324961#M94607</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-27T06:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: tMongoInput Query Parse Error</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMongoInput-Query-Parse-Error/m-p/2324962#M94608</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;HR /&gt; 
 &lt;P&gt;it's not returning any rows.&lt;/P&gt; 
 &lt;PRE&gt;[statistics] connecting to socket on port 3702
[statistics] connected
[statistics] disconnected&lt;/PRE&gt; 
 &lt;HR /&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;P&gt;Do you actually have any data where the begin_date is greater than or equal to today?&amp;nbsp; Try changing gte to lte to see if data is returned to confirm that my suggested syntax works.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;You can use the TalendDate.addDate function to change the date.&amp;nbsp; For example, the code below decrements the day by one, e.g. yesterday:&lt;/P&gt; 
&lt;PRE&gt;"{
begin_date:
{
$gte:{$date:'"+TalendDate.formatDate("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",TalendDate.addDate(new java.util.Date(),-1,"dd"))+"' }
}
}"&lt;/PRE&gt; 
&lt;P&gt;There is documentation on all the TalendDate functions here:&lt;/P&gt; 
&lt;P&gt;&lt;A href="https://help.talend.com/reader/TakcAFoOnWMPdNo8XXlPpg/mOrhvhXRdRX1oRzaNEkNvw" target="_blank" rel="nofollow noopener noreferrer"&gt;https://help.talend.com/reader/TakcAFoOnWMPdNo8XXlPpg/mOrhvhXRdRX1oRzaNEkNvw&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;Although the documentation for the addDate function does not seem correct.&amp;nbsp; It actually takes a Date as an argument but the documentation shows that it takes a date as a string and a format.&amp;nbsp; If you use my addDate example above it will work.&lt;/P&gt;</description>
      <pubDate>Mon, 27 May 2019 06:56:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMongoInput-Query-Parse-Error/m-p/2324962#M94608</guid>
      <dc:creator>nfz11</dc:creator>
      <dc:date>2019-05-27T06:56:31Z</dc:date>
    </item>
  </channel>
</rss>

