robokill 2 hacked full versionQ:
Cannot save Parse-Object in Parse Cloud
I've created my Data.json file in the public folder of Parse.com and stored it there. I'm then going to save it in my Parse-Cloud and test it, but when I open up the Class-Data.json it just shows a list of objects with no data. Do I need to do something extra to save my JSON file into the Parse-Cloud? Here is my code:
var newClass = new Class;
newClass.set("className", "A Class Name");
newClass.set("courseName", "Course Name");
newClass.set("numberOfDays", "21");
newClass.set("showSEMCode", "0");
newClass.saveInBackgroundWithBlock(newBlock(newClass));
A:
You need to specify which object you want to save. Currently you are passing it newClass and it is looking at the class's data as the object.
Try this:
var newClass = new Class.create();
newClass.set("className", "A Class Name");
newClass.set("courseName", "Course Name");
newClass.set("numberOfDays", "21");
newClass.set("showSEMCode", "0");
newClass.saveInBackgroundWithBlock(newBlock(newClass));
function newBlock(newClass){
return new Promise(function (resolve, reject) {
var query = new Class.Query();
query.equalTo("objectId", newClass.objectId());
query.find().then(function (classes) {
//!!!! classes is not what we want here!!!
//!!!!!!!!!!!!!!
classes.forEach(function (class) {
newClass.addObject(class);
}); be359ba680
Related links:
Comments