"2019-03-12T21:53:16.841Z” is an ISO 8601 date.
"ISODate("2019-03-12T21:53:16.841Z”)” is not an ISO 8601 date.
If you could post what is being sent to Solr, that would be helpful.
wunder
Walter Underwood
[email protected]
http://observer.wunderwood.org/ (my blog)
> On May 10, 2019, at 7:09 PM, Erick Erickson <[email protected]> wrote:
>
> Well, the thing you’re getting back from MongoDB isn’t the ISO date format. I
> don’t know enough about MongoDB to understand how to get it to spit out the
> date in the correct format, but that’s where you need to look.
>
> Best,
> Erick
>
>> On May 10, 2019, at 2:13 PM, Abhijit Pawar <[email protected]> wrote:
>>
>> Hello,
>>
>> I am trying to index date in ISODate format like this saved in mongoDB
>> collection using DataImortHandler in SOLR 5.4.1:
>> {
>> .
>> .
>> "endDate" : ISODate("2019-03-12T21:53:16.841Z")
>> }
>>
>> It throws below error:
>> *java.text.ParseException: Unparseable date: "Tue Mar 12 21:53:16 UTC 2019"*
>>
>> Below is the configuration SOLR:
>>
>> *data-source-config.xml:*
>>
>> <entity name="products"
>> dataSource="mongod"
>> transformer="ProdsCatsFieldTransformer,TemplateTransformer"
>> onError="continue"
>> pk="uuid"
>> query="<< query >>"
>> deltaImportQuery="<<deltaImportQuery>>"
>>>
>> <field column="endDate" name="prodendDate" />
>>
>>
>> <entity name="categories"
>>
>> dataSource="mongod"
>>
>> transformer="TemplateTransformer,DateFormatTransformer"
>>
>> onError="continue"
>>
>> pk="uuid"
>>
>> child="true"
>>
>> query="<<query >>"
>>
>> deltaImportQuery="<<deltaImportQuery>>"
>>
>> parentDeltaQuery="<<parentDeltaQuery>>'">
>>
>> *<field column="prodendDate" template="${products.endDate}" />*
>>
>> * <field column="endDate" sourceColName="prodendDate"
>> dateTimeFormat="yyyy-MM-dd'T'HH:mm:ss.SSSZ" locale="en"/>*
>>
>> </entity>
>>
>> </entity>
>>
>> *schema.xml:*
>> <field name="prodendDate" type="string" indexed="true" stored="false"
>> required="false" />
>> *<field name="endDate" type="date" indexed="true" stored="true"
>> required="false"/>*
>>
>> Even tried with yyyy-MM-dd'T'HH:mm:ss format but no luck.
>>
>> Any idea what could be the issue here...
>