camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raul Kripalani <>
Subject Re: MongoDB Jackson Date Mapping Option
Date Wed, 13 Feb 2013 19:12:33 GMT
Hi Ron,

Not at the MongoDB component itself. We just provide this Object => JSON
conversion for convenience, not as a fully-fledged, flexible transformation

That said, Camel provides a camel-jackson data format which is indeed more
flexible and supports injecting a custom ObjectMapper with your
configuration. So before sending to your MongoDB endpoint, you could ask
Camel to perform the JSON marshalling using the marshal() DSL. For example:

JacksonDataFormat jackson = new JacksonDataFormat(objectMapper, null);  //
use 'null' here as we won't be performing any unmarshalling with this data
format, otherwise indicate the unmarshal type, or HashMap.class otherwise


The MongoDB endpoint will detect the input to already be JSON and will
bypass the Object => JSON convenience conversion.

Hope that helps.

P.S.: Sorry for not replying to your private message earlier - today has
been hectic!


*Raúl Kripalani*
Apache Camel Committer
Enterprise Architect, Program Manager, Open Source Integration specialist | | twitter: @raulvk <>

On Wed, Feb 13, 2013 at 7:01 PM, Ron Anderson <> wrote:

> The mongodb component is using the Jackson library for object mapping and
> has
> mapping of dates defaulted to Unix timestamps rather than ISODate.  This
> causes some problems with using the Aggregation Framework and makes queries
> more difficult to view dates.
> There is an option to set this default behavior using the following:
> objectMapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS,
> false);
> Is there a way to get access to the Jackson ObjectMapper to set this option
> during set up of the camel context etc?
> thanks,
> Ron
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message