I try to add an id to an array stored in my database. Is the "addUnique" property that is stated in the parse js guideline not working in the cloud code? How can we add and remove an item from an array? My code that is not working currently is as below:
Parse.Cloud.afterSave('myArchive', function(req) {
var followCount = Parse.Object.extend('followCount');
var query = new Parse.Query(followCount);
query.equalTo('userid', req.user.id);
query.find({
success: function(result) {
if ( result.length > 0 ) {
result[0].addUnique('archiveArray', 'tatattataa'); //the archiveArray is an array in the followCount database
result.save(null, { useMasterKey: true });
}
else {
}
},
error: function(error) {
}
});
});
Hello,
I try to add an id to an array stored in my database. Is the "addUnique" property that is stated in the parse js guideline not working in the cloud code? How can we add and remove an item from an array? My code that is not working currently is as below: