Closed
Description
This is my code for creating a new post:
app.post('/',requireUser, function(req, res) {
var parseUserMe = new Parse.User();
parseUserMe.id = req.user.id;
var post = new Post();
post.set("Desc", req.body.Desc);
post.set("createdBy", parseUserMe);
post.save().then(function(post) {
res.json({ id: post.id });
}, function(error) {
res.json({ error: error });
});
});
But inside MongoDB, the createdBy field is saved as
"_p_createdBy": {
"score": 59,
"updatedAt": {
"$date": "2016-02-23T04:06:29.402Z"
},
"objectId": "SPtdQePtm2",
"__type": "Object",
"className": "_User"
},
instead of this:
"_p_createdBy": "_User$SPtdQePtm2",
which caused the Dashboard to crash and showed the following error on the server:
Uncaught internal server error. [TypeError: mongoObject[key].split is not a function] TypeError: mongoObject[key].split is not a function