I am trying to add data from csv file to mongoDB using NIFI 1.4. CSV file is containing data like:
101,ISODate(2006-01-02T15:04:05.000Z)
and I am using PutMongoRecord
Processor along with CSVReader 1.4.0
controller service.
I have defined my schema as:
{"name" :"agent","type":"string"},
{"name" :"transactiondate","type":"string"}
So as result I am getting output as "ISODate(2006-01-02T15:04:05.000Z)"
in mongoDB as datatype as String but it should be Date . So for that I need output as ISODate("2006-01-02T15:04:05.000Z")
.
Kindly help if there is any way to do so.
TIA
I think you need to convert your date from a string to an Avro logical type. According to this, "For PutMongoRecord all you have to do is use a long annotated as a timestamp or an int annotated as a date and make sure record reader has the format options done configured correctly for timestamp and date."