I'm trying to insert a flow file to MongoDb which has a date record as an
attribute. First I sent that flow file through an attribute to JSON
processor, so that all attributes are now converted to a Json document in
flow file body. When I insert that flow file to Mongodb using PutMongo
processor, it saves the "sent_date" attribute as a String. I want this to
be saved as an ISO date object.

My flow file looked like this.

{
  "dataSourceId" : "xxxx",
  "filename" : "979f7bc5-a395-4396-9625-69fdb2c806c6",
  "sent_date" : "Mon Jan 18 04:50:50 IST 2016",
  "uuid" : "77a5ef56-8b23-40ee-93b5-78c6323e0e1c",
  "originalSource" : "ImportedZip"
}

Then I prepend "ISODate" to "sent_date" attribute using another processor.
So now my flow file content looks like this.
{
  "dataSourceId" : "xxxx",
  "filename" : "979f7bc5-a395-4396-9625-69fdb2c806c6",
  "sent_date" : "ISODate('Mon Jan 18 04:50:50 IST 2016')",
  "uuid" : "77a5ef56-8b23-40ee-93b5-78c6323e0e1c",
  "originalSource" : "ImportedZip"
}

But still It is saved as a string in MongoDB, because of the double
quotation marks. Is there a way to remove those double quotation marks when
convert using AttributeToJson processor?

Any help is appreciated.

-- 
Thanks,
Regards,
ASH

Reply via email to