Hi Ron,

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

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

from("direct:foo").marshal(jackson).to("mongodb:...");


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!

Regards,

*Raúl Kripalani*
Apache Camel Committer
Enterprise Architect, Program Manager, Open Source Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk <http://twitter.com/raulvk>

On Wed, Feb 13, 2013 at 7:01 PM, Ron Anderson <biker_...@yahoo.com> 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:
> http://camel.465427.n5.nabble.com/MongoDB-Jackson-Date-Mapping-Option-tp5727548.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to