{"action":"created","issue":{"url":"https://api.github.com/repos/matb33/meteor-collection-hooks/issues/128","labels_url":"https://api.github.com/repos/matb33/meteor-collection-hooks/issues/128/labels{/name}","comments_url":"https://api.github.com/repos/matb33/meteor-collection-hooks/issues/128/comments","events_url":"https://api.github.com/repos/matb33/meteor-collection-hooks/issues/128/events","html_url":"https://github.com/matb33/meteor-collection-hooks/issues/128","id":88755727,"number":128,"title":"after.insert() and MongoDB $inc modifier","user":{"login":"Jehu","id":650836,"avatar_url":"https://avatars.githubusercontent.com/u/650836?v=3","gravatar_id":"","url":"https://api.github.com/users/Jehu","html_url":"https://github.com/Jehu","followers_url":"https://api.github.com/users/Jehu/followers","following_url":"https://api.github.com/users/Jehu/following{/other_user}","gists_url":"https://api.github.com/users/Jehu/gists{/gist_id}","starred_url":"https://api.github.com/users/Jehu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jehu/subscriptions","organizations_url":"https://api.github.com/users/Jehu/orgs","repos_url":"https://api.github.com/users/Jehu/repos","events_url":"https://api.github.com/users/Jehu/events{/privacy}","received_events_url":"https://api.github.com/users/Jehu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-16T15:12:15Z","updated_at":"2015-06-17T08:20:43Z","closed_at":null,"body":"With this code i get an increment of 2 instead of 1\r\n```\r\nStreets.after.insert(function (userId, doc) {\r\n  Territories.update({\r\n    _id: doc.territory_id\r\n  }, {\r\n    $inc: {streets_count: 1}\r\n  })\r\n});\r\n```\r\n... while the code below entered in browser console increments by 1 like expected:\r\n```\r\nTerritories.update({_id: \"kdo5aSa8XrsirK6Ar\"}, { $inc: {streets_count: 1 } })\r\n```\r\nA ``console.log`` inside of **after.insert() fires just one time** by the way.\r\n\r\nHere a list of installed packages:\r\n```\r\naldeed:autoform          5.3.0  \r\naldeed:simple-schema     1.3.3  \r\nfastclick                1.0.3  \r\nground:db                0.3.9  \r\niron:layout              1.0.8  \r\niron:router              1.0.9  \r\nmatb33:collection-hooks  0.7.13 \r\nmeteor-platform          1.2.2  \r\n```\r\n\r\nI've testet without ground:db too. Same results.\r\nWhat is going wrong here?\r\n"},"comment":{"url":"https://api.github.com/repos/matb33/meteor-collection-hooks/issues/comments/112713958","html_url":"https://github.com/matb33/meteor-collection-hooks/issues/128#issuecomment-112713958","issue_url":"https://api.github.com/repos/matb33/meteor-collection-hooks/issues/128","id":112713958,"user":{"login":"Jehu","id":650836,"avatar_url":"https://avatars.githubusercontent.com/u/650836?v=3","gravatar_id":"","url":"https://api.github.com/users/Jehu","html_url":"https://github.com/Jehu","followers_url":"https://api.github.com/users/Jehu/followers","following_url":"https://api.github.com/users/Jehu/following{/other_user}","gists_url":"https://api.github.com/users/Jehu/gists{/gist_id}","starred_url":"https://api.github.com/users/Jehu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jehu/subscriptions","organizations_url":"https://api.github.com/users/Jehu/orgs","repos_url":"https://api.github.com/users/Jehu/repos","events_url":"https://api.github.com/users/Jehu/events{/privacy}","received_events_url":"https://api.github.com/users/Jehu/received_events","type":"User","site_admin":false},"created_at":"2015-06-17T08:20:43Z","updated_at":"2015-06-17T08:20:43Z","body":"@rclai if i restrict the hook to server or client only, $inc works as expected."}}