{"action":"created","issue":{"url":"https://api.github.com/repos/balderdashy/waterline/issues/1185","labels_url":"https://api.github.com/repos/balderdashy/waterline/issues/1185/labels{/name}","comments_url":"https://api.github.com/repos/balderdashy/waterline/issues/1185/comments","events_url":"https://api.github.com/repos/balderdashy/waterline/issues/1185/events","html_url":"https://github.com/balderdashy/waterline/issues/1185","id":111210725,"number":1185,"title":"findOrCreate creates duplicates","user":{"login":"kolbma","id":5228369,"avatar_url":"https://avatars.githubusercontent.com/u/5228369?v=3","gravatar_id":"","url":"https://api.github.com/users/kolbma","html_url":"https://github.com/kolbma","followers_url":"https://api.github.com/users/kolbma/followers","following_url":"https://api.github.com/users/kolbma/following{/other_user}","gists_url":"https://api.github.com/users/kolbma/gists{/gist_id}","starred_url":"https://api.github.com/users/kolbma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kolbma/subscriptions","organizations_url":"https://api.github.com/users/kolbma/orgs","repos_url":"https://api.github.com/users/kolbma/repos","events_url":"https://api.github.com/users/kolbma/events{/privacy}","received_events_url":"https://api.github.com/users/kolbma/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-13T15:54:09Z","updated_at":"2015-10-13T17:55:44Z","closed_at":"2015-10-13T17:55:44Z","body":"Hi,\r\nif I do something like\r\n\r\nfor (var i=0; i<30; i++) {\r\nwaterline.collections.mymodel.findOrCreate({ip: ip, code: code}, {ip: ip, code: code}, function(err, row){});\r\n}\r\n\r\nin a mocha test, I get multiple rows with {ip: ip, code: code} in my sails-disk-db.\r\n"},"comment":{"url":"https://api.github.com/repos/balderdashy/waterline/issues/comments/147795511","html_url":"https://github.com/balderdashy/waterline/issues/1185#issuecomment-147795511","issue_url":"https://api.github.com/repos/balderdashy/waterline/issues/1185","id":147795511,"user":{"login":"devinivy","id":3150233,"avatar_url":"https://avatars.githubusercontent.com/u/3150233?v=3","gravatar_id":"","url":"https://api.github.com/users/devinivy","html_url":"https://github.com/devinivy","followers_url":"https://api.github.com/users/devinivy/followers","following_url":"https://api.github.com/users/devinivy/following{/other_user}","gists_url":"https://api.github.com/users/devinivy/gists{/gist_id}","starred_url":"https://api.github.com/users/devinivy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devinivy/subscriptions","organizations_url":"https://api.github.com/users/devinivy/orgs","repos_url":"https://api.github.com/users/devinivy/repos","events_url":"https://api.github.com/users/devinivy/events{/privacy}","received_events_url":"https://api.github.com/users/devinivy/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T17:55:44Z","updated_at":"2015-10-13T17:55:44Z","body":"There is a plan for transaction support in #1141, which is as far as I think we get get you.  Bear in mind that I/O (such as database queries) will inherently be done asynchronously in javascript.  It's just a characteristic of the language.  I'm going to close this because I don't think we can get much further with current features and plans, but I'd encourage suggestions for a well-spec'd feature request.  We can talk about that here a bit despite the original issue being closed."}}