-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong format of user object saved in MongoDB after pasing thru beforeSave #589
Comments
I was frustrated as the problem only occurs when creating new post, not in comments or other objects. Now I can confirm the problem is related to the beforeSave trigger function. If I commented out the beforeSave function, the format is correct. Below is my beforeSave trigger function:
|
cc @nlutsenko who has been looking in to the triggers recently... Looks like this pointer saved from cloud code isn't being transformed properly. |
Yup, looks like it - looking into the best way to go about fixing it, but in the meantime - if you save the user before saving the post - it should properly resolve to full object save. |
Got a test case that fails, that's a good start, it is attached to the fact that we don't collapse objects back into pointers for child objects that could be saved in the middle of running a beforeSave. |
The problem also occurs when I used a fetched user i.e. req.user instead of parseUserMe. |
Yup, all of it is going to be fixed by the Pull Request attached to this issue. |
Thanks so much, you guys are awesome!! |
This is my code for creating a new post:
But inside MongoDB, the createdBy field is saved as
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
The text was updated successfully, but these errors were encountered: