camel-karavan icon indicating copy to clipboard operation
camel-karavan copied to clipboard

Not able to store data in mongodb

Open ninjahail opened this issue 3 years ago • 1 comments

I am trying to store data received data(Json) from timer source in mongodb. But i am getting the below error. org.apache.camel.component.mongodb.CamelMongoDbException: MongoDB operation = insert, Body is not conversible to type Documentt nor List<Document>

I am following this example online: https://dzone.com/articles/apache-camel-mongodb-component-example?fbclid=IwAR0u8VuBNWmJtIyz7RRF9iYpYD9XTHmqorMopfbxQz884HO6QSkEjqhyXsY. When I get to the steps of trying to insert {name:"Anne"} into my database by making a POST request using Postman, I keep getting this error:

org.apache.camel.component.mongodb.CamelMongoDbException: MongoDB operation = insert, Body is not conversible to type DBObject nor List<DBObject>. The content-type I have set is raw (text).

I have tried adding .convertBodyTo("Document.class") after the from, but that gave me this error caused by: No type converter available to convert from type: org.apache.camel.converter.stream.InputStreamCache to the required type:

ninjahail avatar Jun 28 '22 12:06 ninjahail

Is this problem related to Karavan or the general Camel issue?

mgubaidullin avatar Jul 27 '22 23:07 mgubaidullin