I want to update an element inside an array using the updatecallback method. I want to do it this way as I don't want to do a wholesale update on the document. I am using the updatecallback javascript API and I am getting the bad request error while the same query works in my mongodb shell.
I am using this MongoDB format:
db.collection.update( { <query selector> }, { <update operator>: { "array.$.field" : value } } )
Here is my query:
Javascript code:
col_society_evaluation.updateCallback({"memberno":selectedevalmemno, "nomination_class":nomclass, "societyid":societyid, "profiletype":"evaluator", "nominationsassigned.nominations.packageid":nompackageid}, { $set: { "nominationsassigned.nominations.$.assignmentstatus" : "unassigned" } }, updateEvaluatorsSuccess, updateEvaluatorsFailure);
P_query value from the console:
P_query {"memberno":"00744920","nomination_class":"2015","societyid":"MEMRA024","profiletype":"evaluator","nominationsassigned.nominations.packageid":"1394134282704"}
Post data:
{"$set":{"nominationsassigned.nominations.$.assignmentstatus":"unassigned"}}
Since the same query works in my mongodb shell, I am confused.
Thanks a lot in advance for your help!
Regards,
Siva
--
Dimitri MELCHIOR
--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "RunMyProcess Support Forum" 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 http://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/2cce1909-86d6-40cf-8c34-5c7dc3028f6c%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.
Thanks for your quick response.
It does not throw and error but it does not update the document either. Here is my root document. I want to update the "notificationstatus" of an array element with unassigned without doing the wholesale update.
Can you help me to get the query for the listcallback?
Also, I noticed that, a double dot notation is throwing an error.
{
"citation": "for contributions to integrated high-speed and radio-frequency silicon devices and components.",
"memberno": "44444444",
"nomination_class": "2015",
"invitestatus": "Accepted",
"nominationsassigned": {
"nominations": [{
"packageid": "1393470473367",
"assignmentstatus": "assigned",
"notificationstatus": "notified",
"evaluation_instanceid": "0e6e4b54-2578-11e4-aec8-123139225512",
"conflict": {
"status": "yes",
"reason": "some reason sdjgdokfjg"
}
},
{
"packageid": "1393470872845",
"assignmentstatus": "assigned",
"notificationstatus": "notified",
"evaluation_instanceid": "4b0835d0-2578-11e4-aa5d-1231380c7265",
"conflict": {
"reason": "ftutfy",
"status": "yes"
}
},
{
"packageid": "1393469683231",
"assignmentstatus": "assigned",
"evaluation_instanceid": "fbc83c30-26fe-11e4-aa5d-1231380c7265",
"notificationstatus": "notified",
"conflict": {
"status": "yes",
"reason": "some reason"
}
},
{
"packageid": "1394134282704",
"assignmentstatus": "assigned",
"evaluation_instanceid": "7a0314a0-271b-11e4-b72c-12313b0614f1",
"notificationstatus": "notified"
}]
},
"lastname": "Burghartz",
"firstname": "Joachim",
"profiletype": "evaluator",
"insertdate": "2014-08-16 12:34:40",
"email": "x...@ieee-dev.org",
"invitetaskurl": "https://live.runmyprocess.com/live/2215365968/form/38623df4-2563-11e4-aa5d-1231380c7265/2/0",
"notifiedtime": "1408395975155",
"technicalareas": {
"techareavalue": ["Computer and robot vision",
"Manufacturing automation",
"Motion and path planning",
"Sensor design,integration, and fusion"]
},
"secondary_email": "",
"societyname": "IEEE Robotics & Automation Society",
"societyid": "MEMRA024"
}
Thank you!
Regards,
Siva
To make this simple, I did some changes to my schema to remove one layer of object. Now here is the new document structure. Now I need to update the assignmentstatus inside the nominations array.
I am still getting the bad request.
{
"citation": "for contributions to decoding and detection that include reliability information",
"email": "peteradam....@ieee-dev.org",
"firstname": "PeterAdam",
"insertdate": "2014-08-19 15:26:44",
"invitestatus": "Accepted",
"invitetaskurl": "https://live.runmyprocess.com/live/2215365968/form/e4d338d0-27d6-11e4-aec8-123139225512/2/0",
"lastname": "Hoeher",
"memberno": "00799619",
"nomination_class": "2015",
"profiletype": "evaluator",
"secondary_email": "",
"societyid": "MEMC016",
"societyname": "IEEE Computer Society ",
"technicalareas": {
"techareavalue": ["Computer education",
"Applications"]
},
"nominations": [{
"packageid": "1401891319015",
"assignmentstatus": "assigned",
"notificationstatus": "new"
}]
}
Thanks for your help!
Regards,
Siva
--
Dimitri MELCHIOR
Regards,
Siva
--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "RunMyProcess Support Forum" 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 http://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/24c1912f-09b3-4d84-a50c-83cdcb6397e4%40runmyprocess.com.
I am getting a javascript error with the P_query you sent. Here is the error:
P_query.nominationsassigned.nominations is undefined
That is bcos we dont define the nominations in the code below:
P_query.nominationsassigned = {};
P_query.nominationsassigned.nominations.packageid = "1394134282704";
But anyway, to make it simple, I have updated the schema. I have removed the intermediate nominationsassigned object and made the nominations an array into the root object. Here is the sample root document:
{
"citation": "for contributions to decoding and detection that include reliability information",
"email": "peteradam....@ieee-dev.org",
"firstname": "PeterAdam",
"insertdate": "2014-08-19 15:26:44",
"invitestatus": "Accepted",
"invitetaskurl": "https://live.runmyprocess.com/live/2215365968/form/e4d338d0-27d6-11e4-aec8-123139225512/2/0",
"lastname": "Hoeher",
"memberno": "00799619",
"nomination_class": "2015",
"profiletype": "evaluator",
"secondary_email": "",
"societyid": "MEMC016",
"societyname": "IEEE Computer Society ",
"technicalareas": {
"techareavalue": ["Computer education",
"Applications"]
},
"nominations": [{
"packageid": "1401891319015",
"assignmentstatus": "assigned",
"notificationstatus": "new"
}]
}
Thank you!
Regards,
Siva
--
Dimitri MELCHIOR
That is not valid anymore since I have removed the intermediate object. So one dot notation is enough now. I just tested it now, I am seeing this error as part of the response.
{"error":"com.mongodb.WriteConcernException: { \"serverUsed\" : \"live-bo-14:27017\" , \"err\" : \"not okForStorage\" , \"code\" : 12527 , \"n\" : 0 , \"lastOp\" : { \"$ts\" : 1408645311 , \"$inc\" : 3} , \"connectionId\" : 137935 , \"ok\" : 1.0}"}
Regards,
Siva
Do we have any update on this?
Thank you!
Regards,
Siva