updating object Collection

202 views
Skip to first unread message

J.M.

unread,
Dec 15, 2015, 3:01:45 AM12/15/15
to Fujitsu RunMyProcess Developer Community
Hi,

I'm building a project with the most used collection operations, sucha as add object, delete object, count, etc. in order to an easy future use.
I'm building a new Composite API for each operation, so when I want to use it I will only include the project and put the right connector (CAPI).

However, I'm having a problem, all my operations work fine unless the update object.
the code in my CAPI is like that:
${update_objects( my_query_object, my_new_object, my_collection, multi)}

and the parameters I'm passing from the process in input parameters are:
my_query_object =
{
"campo1":"valor1"
}

my_new_object =
{
"campo1":"valor1",
"campo2":"valor2",
"campoX":"valorX"
}

my_collection = Testing

multi = true

At first i thought it could be wrong because of some quotes, but the objects and the collections are well builded, so I've tried with the multi field. And I've tried with some values for testing:
- if multi = false, it works fine, but only update the first object (which I know is normal)
- if multi = "true", it works like the previous case. I guess the function does not identify true with the quotes and it uses the false value by default
- Finally, if multi = true I get this:
2015-12-15T07:40:47+0000 - Task "Contar objetos de collection" (id: 1[0] - status: ACTIVE): 2015-12-15T07:40:46+0000 - Task "Actualizar objeto completo de collection" (id: 1[0] - status: ABORTED): Error while processing {update_objects( my_query_object, my_new_object, my_collection, multi)}

: com.mongodb.WriteConcernException: { "serverUsed" : "live-bo-25:27017" , "ok" : 1 , "n" : 0 , "updatedExisting" : false , "err" : "multi update only works with $ operators" , "code" : 9}

So... What's really happening? Why am I getting this error?
I want to parameterize the CAPI, but how can I achieve that?

Thanks in advance and regards.

Pankaj Kumar

unread,
Dec 20, 2015, 12:39:07 PM12/20/15
to Fujitsu RunMyProcess Developer Community
Hi,

To update multi objects in a collection, please update your query as follows:-

${update_objects( my_query_object, { '$set': my_new_object }, my_collection, true)}

Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support


--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/c9376a99-5a0f-4dcf-9c4c-73fde82d1432%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.

J.M.

unread,
Dec 22, 2015, 2:16:04 AM12/22/15
to Fujitsu RunMyProcess Developer Community
Hi Pankaj,

Thank you very much for the reply and the help. Now it's working.

Regards.
Reply all
Reply to author
Forward
0 new messages