I want to delete NCMB objects.

Asked 2 years ago, Updated 2 years ago, 64 views

We are developing with Monaca and nifty cloud.
I'd like to delete the object stored on the datastore in destroy, but should I get the objectId and delete it?
sample.get("objectId"; but the objectId is returned undefined.
Also, if not, please let me know the specific method.

var Notice=NCMB.Object.extend("notice");
var noticeQuery=new NCMB.Query("notice");

var notice = new Notice();
var array = new Array();

noticeQuery.find({
            // Successful
    success:function(objects){
        for (vari=0;i<objects.length;i++){
            array[i] = objects[i].get("objectId");
            notice.set("objectId", array[0]);
            notice.destroy();
            notice.save();
        }
    },

    // In case of failure
    error: function(error) {
        // Error indication
        alert('Failed to get object, with error code:'+error.description);
   }
});

monaca

2022-09-30 21:10

1 Answers

http://mb.cloud.nifty.com/doc/current/datastore/basic_usage_javascript.html#Delete Object

I'm not sure about the 1.2 series because the documentation is gone.


objects[i].destroy({
) success:function() {
// US>Delete Completed
},
error:function() {
// Delete failed
}
});

Then, will it not work?


2022-09-30 21:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.