Yahya
Posts: 0
Joined: Tue Nov 11, 2014 1:08 pm

update an array in database

Dears,

I want to use mongoDB $push or $addToSet to append to an array in a collection
when I execute the below code I got successful result but no update happen to the array in the collection , please advise.

update_request_login_page.execute({
'data' : {
"$addToSet": {"driversRecivedTheRequest": "999999" }

Code: Select all

                                         }, 

                                         'parameters': { 
                                                 reqID: "5a63c695a428937aa506b06f" 
                                         }, 
                                         success: function(data){ 
                                             toast('تم تعديل حالة الطلب..!!'); 
                                         }, 

                                         error: function(e){ 
                                            toast('خطأ لم يتم تعديل حالت الطلب..!!'); 
                                         } 
                                     });
Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

update an array in database

Hello,

Appery.io doesn't support these parameters ($push and $addToSet).

Please look at this example how to add a unique value to the array: https://docs.appery.io/reference#data...

Yahya
Posts: 0
Joined: Tue Nov 11, 2014 1:08 pm

update an array in database

Thank you for the response, in fact I want to add a string to an existing array example:
var name="john";
"deviceRejectedTheRequest":{"__op":"AddUnique","objects":jhon}

the above command failed to add the name to the array object in database.
the array in database like : ["sara","warren","sam"] , how to add "Jhon" to this array.

Thank you.

Yahya
Posts: 0
Joined: Tue Nov 11, 2014 1:08 pm

update an array in database

Any update

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

update an array in database

Please send the variable "name" in your request. It seems the variable "jhon" is not defined there.

Could you please clarify what you have tried and what exactly does not work?

Please check if there are any errors in the browser console. You can learn here: https://docs.appery.io/docs/using-bro... how to open the console.

Return to “Issues”