{"action":"created","issue":{"url":"https://api.github.com/repos/SoftInstigate/restheart/issues/252","repository_url":"https://api.github.com/repos/SoftInstigate/restheart","labels_url":"https://api.github.com/repos/SoftInstigate/restheart/issues/252/labels{/name}","comments_url":"https://api.github.com/repos/SoftInstigate/restheart/issues/252/comments","events_url":"https://api.github.com/repos/SoftInstigate/restheart/issues/252/events","html_url":"https://github.com/SoftInstigate/restheart/issues/252","id":268126137,"number":252,"title":"Obtain doc-id for POST which creates new document within Hook","user":{"login":"visualist","id":843003,"avatar_url":"https://avatars0.githubusercontent.com/u/843003?v=4","gravatar_id":"","url":"https://api.github.com/users/visualist","html_url":"https://github.com/visualist","followers_url":"https://api.github.com/users/visualist/followers","following_url":"https://api.github.com/users/visualist/following{/other_user}","gists_url":"https://api.github.com/users/visualist/gists{/gist_id}","starred_url":"https://api.github.com/users/visualist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/visualist/subscriptions","organizations_url":"https://api.github.com/users/visualist/orgs","repos_url":"https://api.github.com/users/visualist/repos","events_url":"https://api.github.com/users/visualist/events{/privacy}","received_events_url":"https://api.github.com/users/visualist/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-10-24T17:48:57Z","updated_at":"2017-10-26T04:49:21Z","closed_at":null,"author_association":"NONE","body":"Hi guys, me again. We've got Restheart working for us in production for all but this use case. Thanks for making such an excellent production! I'm running version 3.1.3.\r\n\r\nI'm looking for the best/recommended way to obtain the ID of a newly-created document from within the hook() method (implements Hook) from this scenario:\r\n\r\n- POST /db/coll\r\n- RH creates /db/coll/59ef6c1e967f2a0bbb584d8f\r\n- hook() is called, would like to know 59ef6c1e967f2a0bbb584d8f is the ID\r\n\r\nI've tried various ways with inconsistent results, for example:\r\n\r\n- context.getDbOperationResult().getNewId() -- seems like the obvious choice, but it's null\r\n- context.getNewData().get(\"_id\").asObjectId().getValue() -- this works in the IntelliJ debugger, but not once it's deployed, or at least not consistently.\r\n\r\nI was hoping there was a straightforward way to get ID & I'm must missing something. Thanks."},"comment":{"url":"https://api.github.com/repos/SoftInstigate/restheart/issues/comments/339550374","html_url":"https://github.com/SoftInstigate/restheart/issues/252#issuecomment-339550374","issue_url":"https://api.github.com/repos/SoftInstigate/restheart/issues/252","id":339550374,"user":{"login":"visualist","id":843003,"avatar_url":"https://avatars0.githubusercontent.com/u/843003?v=4","gravatar_id":"","url":"https://api.github.com/users/visualist","html_url":"https://github.com/visualist","followers_url":"https://api.github.com/users/visualist/followers","following_url":"https://api.github.com/users/visualist/following{/other_user}","gists_url":"https://api.github.com/users/visualist/gists{/gist_id}","starred_url":"https://api.github.com/users/visualist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/visualist/subscriptions","organizations_url":"https://api.github.com/users/visualist/orgs","repos_url":"https://api.github.com/users/visualist/repos","events_url":"https://api.github.com/users/visualist/events{/privacy}","received_events_url":"https://api.github.com/users/visualist/received_events","type":"User","site_admin":false},"created_at":"2017-10-26T04:49:21Z","updated_at":"2017-10-26T04:49:21Z","author_association":"NONE","body":"Yes, I will test this out and get back to you."}}
{"actor":{"display_login":"visualist"}}