Reputation: 4378
I'm probably missing something stupid, but my initializer function for a custom parse class isn't working in cloud code. I have the following in my cloud code, and call the "createAStatisticTest" function from my client, which successfully creates and saves a new Statistics object, but doesn't update any of the data to 0. All of the data is (undefined). Can anyone point out what I'm doing wrong?
var Statistics = Parse.Object.extend("Statistics",
{ //instance methods
initialize: function(attrs, options)
{
this.newUsers = 0;
this.newBillableUsers = 0;
this.firstCut = 0;
this.additionalCuts = 0;
this.numCuts = 0;
this.totalBillableUsers = 0;
}
},
{} //class methods
);
//Create a single statistics object to show that the parameters inside of the intialize function aren't being set properlly
Parse.Cloud.define("createAStatisticTest", function(request, status)
{
var statistics = new Statistics();
statistics.save().then
(
function( statistics )
{
status.success("Saved the statistic object");
},
function( error )
{
status.error("There was an error saving the object: " + error.message);
}
)
});
I based my implementation off of the js guide's Monster object example found here
Upvotes: 0
Views: 90