If you're using Camel >= 2.10.3 or 2.11, enable the writeResultAsHeader endpoint option.
In the future, please use the users@ forum for such queries. And please remember to always indicate what version of Camel you're running on. Regards, *Raúl Kripalani* Apache Camel PMC Member & Committer | Enterprise Architect, Open Source Integration specialist http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani http://blog.raulkr.net | twitter: @raulvk On Fri, Nov 8, 2013 at 7:11 PM, bipin.sutariya <bipin.sutar...@gmail.com>wrote: > I am trying to save some data in MongoDB using apache Camel. Following is > my > code > > from("direct:saveData") > .process(dataSaveRequestProcessor) > .streamCaching() > > .to("mongodb:emailDB?database=myDB&collection=myData&operation=save&writeConcern=safe&writeResultAsHeader=true") > .process(dataSaveResponseProcessor); > > Now issue is in MongoDB record is saved, but it is not returned back to my > Response Processor. I need _id that is generated in MongoDB to pass to > another Route. > > > Following is System.out in Response Processor > > ===============> OUT BODY : null > ===============> OUT BODY HEADER: {} > ===============> IN BODY : { "serverUsed" : "/127.0.0.1:27017" , "n" : 0 , > "connectionId" : 22 , "err" : null , "ok" : 1.0} > ===============> IN BODY HEADER : {CamelMongoWriteResult={ "serverUsed" : > "/127.0.0.1:27017" , "n" : 0 , "connectionId" : 22 , "err" : null ,"ok" > : > 1.0}, CamelMongoDbLastError={ "serverUsed" : "/127.0.0.1:27017" , "n" : 0 > , > "connectionId" : 22 , "err" : null , "ok" : 1.0}} > > > Can anybody pointed out where I am making mistake. Why there is not _id in > exchange.getIN().getBody() > > Thank you in Advance > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/MongoDB-exchange-Out-Body-is-null-using-Apache-Camel-tp5742888.html > Sent from the Camel Development mailing list archive at Nabble.com.