{"action":"created","issue":{"url":"https://api.github.com/repos/strongloop/loopback/issues/1354","labels_url":"https://api.github.com/repos/strongloop/loopback/issues/1354/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback/issues/1354/comments","events_url":"https://api.github.com/repos/strongloop/loopback/issues/1354/events","html_url":"https://github.com/strongloop/loopback/issues/1354","id":72526628,"number":1354,"title":"Modifying query var with access operation hook, leads to data loss in before save operation hook","user":{"login":"superdave2u","id":3734136,"avatar_url":"https://avatars.githubusercontent.com/u/3734136?v=3","gravatar_id":"","url":"https://api.github.com/users/superdave2u","html_url":"https://github.com/superdave2u","followers_url":"https://api.github.com/users/superdave2u/followers","following_url":"https://api.github.com/users/superdave2u/following{/other_user}","gists_url":"https://api.github.com/users/superdave2u/gists{/gist_id}","starred_url":"https://api.github.com/users/superdave2u/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superdave2u/subscriptions","organizations_url":"https://api.github.com/users/superdave2u/orgs","repos_url":"https://api.github.com/users/superdave2u/repos","events_url":"https://api.github.com/users/superdave2u/events{/privacy}","received_events_url":"https://api.github.com/users/superdave2u/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-01T21:23:13Z","updated_at":"2015-05-02T19:31:19Z","closed_at":null,"body":"https://github.com/superdave2u/loopback-sandbox\r\n\r\nThe goal of my project is to have one URL for creating, updating, and reading a record based on a string key\r\n\r\n- PUT http://example.com/api/store/stringKey \r\nShould update or create a record with the key provided\r\n\r\n- GET http://example.com/api/store/stringKey \r\nshould retreive the data assoicated with the key or return an error if it does not exist.\r\n\r\nI've added a hunk of code to my Store model using an operation hook on 'access' event. If the property 'key' exists in the query it will filter it to lowercase and remote all but alphanumeric characters.\r\n\r\nThere are unit tests inside the repo triggered with \"npm test\"\r\n\r\nTo manually test start the server with \"slc run\" then visit the explorer. Using PUT method you can enter:\r\n\r\n```\r\n{\r\n  \"key\":\"stringKey\",\r\n  \"value\":\"someValue\"\r\n}\r\n```\r\n\r\nThis will return a validation error stating the the \"key\" property is required."},"comment":{"url":"https://api.github.com/repos/strongloop/loopback/issues/comments/98390328","html_url":"https://github.com/strongloop/loopback/issues/1354#issuecomment-98390328","issue_url":"https://api.github.com/repos/strongloop/loopback/issues/1354","id":98390328,"user":{"login":"OwenBrotherwood","id":866122,"avatar_url":"https://avatars.githubusercontent.com/u/866122?v=3","gravatar_id":"","url":"https://api.github.com/users/OwenBrotherwood","html_url":"https://github.com/OwenBrotherwood","followers_url":"https://api.github.com/users/OwenBrotherwood/followers","following_url":"https://api.github.com/users/OwenBrotherwood/following{/other_user}","gists_url":"https://api.github.com/users/OwenBrotherwood/gists{/gist_id}","starred_url":"https://api.github.com/users/OwenBrotherwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OwenBrotherwood/subscriptions","organizations_url":"https://api.github.com/users/OwenBrotherwood/orgs","repos_url":"https://api.github.com/users/OwenBrotherwood/repos","events_url":"https://api.github.com/users/OwenBrotherwood/events{/privacy}","received_events_url":"https://api.github.com/users/OwenBrotherwood/received_events","type":"User","site_admin":false},"created_at":"2015-05-02T19:31:19Z","updated_at":"2015-05-02T19:31:19Z","body":"I would really like to know why the method does not work https://github.com/superdave2u/loopback-sandbox/blob/master/common/models/store.js\r\n\r\nThe change of ctx looks reasonable but then there could be a deep magic that has to be understood.\r\n"}}