Troubleshooting column at parse.com
My goal is to clear the pointer column of the parse object:
var query = new Parse.Query("MyClass");
query.get("myobjectid").then(function(o) {
o.pointerColumn = undefined;
return o.save();
}).then(function() {
var query2 = new Parse.Query("MyClass");
return query2.get("myobjectid");
}).then(function(o) {
alert(o.pointerColumn);
});
The warning (and the data browser) shows me that the column value still exists. Am I going about this wrong?
+3
source to share
2 answers
It turns out Parse.Object provides a method called unset
to make a column value undefined. My code, rewritten to work, looks like this:
var query = new Parse.Query("MyClass");
query.get("myobjectid").then(function(o) {
o.unset("pointerColumn");
return o.save();
}).then(function() {
var query2 = new Parse.Query("MyClass");
return query2.get("myobjectid");
}).then(function(o) {
alert(o.pointerColumn); // alerts undefined, as expected
});
+6
source to share