{"action":"reopened","issue":{"url":"https://api.github.com/repos/parse-community/parse-server/issues/5186","repository_url":"https://api.github.com/repos/parse-community/parse-server","labels_url":"https://api.github.com/repos/parse-community/parse-server/issues/5186/labels{/name}","comments_url":"https://api.github.com/repos/parse-community/parse-server/issues/5186/comments","events_url":"https://api.github.com/repos/parse-community/parse-server/issues/5186/events","html_url":"https://github.com/parse-community/parse-server/issues/5186","id":382779035,"node_id":"MDU6SXNzdWUzODI3NzkwMzU=","number":5186,"title":"Save pointer to new object in beforeSave","user":{"login":"mtrezza","id":5673677,"node_id":"MDQ6VXNlcjU2NzM2Nzc=","avatar_url":"https://avatars2.githubusercontent.com/u/5673677?v=4","gravatar_id":"","url":"https://api.github.com/users/mtrezza","html_url":"https://github.com/mtrezza","followers_url":"https://api.github.com/users/mtrezza/followers","following_url":"https://api.github.com/users/mtrezza/following{/other_user}","gists_url":"https://api.github.com/users/mtrezza/gists{/gist_id}","starred_url":"https://api.github.com/users/mtrezza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtrezza/subscriptions","organizations_url":"https://api.github.com/users/mtrezza/orgs","repos_url":"https://api.github.com/users/mtrezza/repos","events_url":"https://api.github.com/users/mtrezza/events{/privacy}","received_events_url":"https://api.github.com/users/mtrezza/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-11-20T17:45:29Z","updated_at":"2018-11-21T04:53:41Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"### Issue Description\r\n\r\nIt is currently not possible to reference an object in its `beforeSave` hook to create a new object with a pointer to it.\r\n\r\n### Steps to reproduce\r\n\r\n_Example scenario:_\r\nA user in `User` class should have a user profile in `UserProfile` class associated with it. A user profile has a pointer to the user.\r\n\r\nIt is currently only possible to create the user profile in the user's `afterSave` hook. But immediately after saving the user, other API calls may look for the user profile which does not exist. It is not a solution to create a user profile if it does not exists, as that can cause race conditions in which multiple user profiles are created. It is also not a solution to set the pointer to the user as `unique` in the mongoDB collection which prevents multiple user profile from being created but also causes data loss, because the information to update the user profile with is lost after the failed call.\r\n \r\n### Expected Results\r\n\r\nIt should be possible to create a pointer to an object in its `beforeSave` hook.\r\n\r\n### Actual Outcome\r\n\r\nTrying to save a user profile causes a timeout in path=\"/parse/batch\".\r\n\r\n### Environment Setup\r\n\r\n- **Server**\r\n  - parse-server version: 2.8.4\r\n  - Localhost or remote server: Heroku\r\n\r\n- **Database**\r\n  - MongoDB version: 3.6.7\r\n  - Localhost or remote server: mLab\r\n\r\n### Logs/Trace\r\n\r\n-\r\n"}}
{"actor":{"display_login":"acinader"}}