Blogger Information
Blog 17
fans 0
comment 0
visits 23121
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Bmob删除单条数据
飞鸿先森的博客
Original
1933 people have browsed it

使用Bmob开发过程中,会遇到很多疑惑,官方文档给的都是代码片段,常常会不知道一些东西怎么获取的,说说怎么根据objectId删除一条数据吧,批量删除官方文档给的挺详细的。

知道数据的objectId,删除这条数据,首先通过objectId获取到这个对象,再删除这个对象,即可删除数据。

var Account = Bmob.Object.extend("account");  
var account = new Bmob.Query(Account);  
account.get(that.data.objId,{  
   success: function(res) {  
       //console.log("查询成功"+res)  
       res.destroy({  
           success: function(dres) {  
                console.log("删除成功!");  
           },  
           error: function(){  
                console.log("删除失败!");  
           }  
       })  
   }  
})

其中account是bmob中的一张表,上面的代码是在微信小程序开发中用到的,JavaScript等其他语言语法类似。



Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post