Hi all,

I am trying out a sample in which I have used Apache camel component for
MongoDB.

Below is my route:
//Below line queries MongoDB to get the result
from("jetty:http://localhost:8181/dataByQuery";)
        
.to("mongodb:myDb?database=DataDB&collection=data&operation=findOneByQuery");
//Below line inserts data to mongoDB
from("jetty:http://localhost:8181/dataInsert";)
                //.convertBodyTo(ListJacksonDataFormat.class)
                //.convertBodyTo(String.class)
                //.marshal(jackson)
                //.convertBodyTo(String.class)
                .convertBodyTo(DBObject.class)
                
.to("mongodb:myDb?database=DataDB&collection=data&operation=insert");

Now I am invoking the insert Operation i.e.http://localhost:8181/dataInsert
URL from saopUI and passing
Body as:
{
  "DataID": "19dd8a2e-45cb-40cc-ba2c-15d5a81733f8",
  "DataDescription": "Data High",
  "DataPriority": "High",
  "CreatedDateTimeUTC": "2015-01-12T16:39:42.132Z"
}

The above payload gets inserted into MongoDB but the CreatedDateTimeUTC gets
inserted as String instead of Date.

I have tried MongoDB sample through java code and am able to insert Date as
ISODate. But when I am trying to insert data using camel . I am not able to
do so.

So my question is how can I insert CreatedDateTimeUTC as Date Object in
MongoDB.




--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-insert-Date-String-as-date-in-MongoDB-tp5778310.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to