Closed
Description
Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!
- You've met the prerequisites.
- You're running the latest version of Parse Server.
- You've searched through existing issues. Chances are that your issue has been reported or resolved before.
Environment Setup
- Localhost
- Node 5.7
- MongoDB 3.2.3
Steps to reproduce
In main.js add
- define a test class
- define before save for it to update 1 attribute
- define a cloud function that you can use to try this via Postman or something
- I expect the beforeSave to set/update an attribute but its not happening ...
var Testing1 = Parse.Object.extend('Testing1');
Parse.Cloud.beforeSave('Testing1', function(req, res) {
var obj = req.object;
console.log('In b4 save Testing1', obj.toJSON());
obj.set('override', Date.now());
res.success(obj);
});
Parse.Cloud.define('test', function(req, res) {
var t1 = new Testing1({ name: 'X' });
t1.save()
.then(o => {
console.log('After saving', o.toJSON());
res.success(o);
})
.fail(err => res.error(err.message));
})
The result:
{
"result": {
"name": "X",
"createdAt": "2016-03-06T10:22:20.041Z",
"updatedAt": "2016-03-06T10:22:20.041Z",
"objectId": "eyw0agyTof",
"__type": "Object",
"className": "Testing1"
}
}
override
attribute not set as expected
Logs/Trace
Metadata
Metadata
Assignees
Labels
No labels