Upserting map using mule mongodb connector -


i using mule's mongodb connector update document in items collection. element trying update in document map shown below --

 "ratings": {"stars":4.5 , "votes":232}, 

however, connector updates subitem string --

 "ratings": "{\"stars\":4.5 , \"votes\":232}", 

here flow doing update --

    <flow name="update-subitem-in-db">     <logger message="updating in db item #[itemid] -- #[payload] )" level="info" doc:name="logger" />     <mongo:update-objects-by-function-using-map         collection="items" config-ref="mongo_db" doc:name="update object"         upsert="true" function="$set" multi="false">         <mongo:query-attributes>             <mongo:query-attribute key="_id">#[itemid]</mongo:query-attribute>         </mongo:query-attributes>         <mongo:element-attributes>             <mongo:element-attribute key="ratings">#[payload]</mongo:element-attribute>         </mongo:element-attributes>     </mongo:update-objects-by-function-using-map> </flow> 

any suggestions re: how resolve issue?

    <json:json-to-object-transformer doc:name="json object" returnclass="java.util.hashmap"/> 

then can call

    #[message.payload.ratings.stars] 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -