{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/3341","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/3341/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/3341/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/3341/events","html_url":"https://github.com/Automattic/mongoose/issues/3341","id":104869910,"number":3341,"title":"MongooseArray.pull Does Not Work on Subdocuments","user":{"login":"c1moore","id":6350063,"avatar_url":"https://avatars.githubusercontent.com/u/6350063?v=3","gravatar_id":"","url":"https://api.github.com/users/c1moore","html_url":"https://github.com/c1moore","followers_url":"https://api.github.com/users/c1moore/followers","following_url":"https://api.github.com/users/c1moore/following{/other_user}","gists_url":"https://api.github.com/users/c1moore/gists{/gist_id}","starred_url":"https://api.github.com/users/c1moore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c1moore/subscriptions","organizations_url":"https://api.github.com/users/c1moore/orgs","repos_url":"https://api.github.com/users/c1moore/repos","events_url":"https://api.github.com/users/c1moore/events{/privacy}","received_events_url":"https://api.github.com/users/c1moore/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Automattic/mongoose/labels/can't%20reproduce","name":"can't reproduce","color":"bfdadc"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Automattic/mongoose/milestones/58","html_url":"https://github.com/Automattic/mongoose/milestones/4.1.7","labels_url":"https://api.github.com/repos/Automattic/mongoose/milestones/58/labels","id":1282469,"number":58,"title":"4.1.7","description":"","creator":{"login":"vkarpov15","id":1620265,"avatar_url":"https://avatars.githubusercontent.com/u/1620265?v=3","gravatar_id":"","url":"https://api.github.com/users/vkarpov15","html_url":"https://github.com/vkarpov15","followers_url":"https://api.github.com/users/vkarpov15/followers","following_url":"https://api.github.com/users/vkarpov15/following{/other_user}","gists_url":"https://api.github.com/users/vkarpov15/gists{/gist_id}","starred_url":"https://api.github.com/users/vkarpov15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkarpov15/subscriptions","organizations_url":"https://api.github.com/users/vkarpov15/orgs","repos_url":"https://api.github.com/users/vkarpov15/repos","events_url":"https://api.github.com/users/vkarpov15/events{/privacy}","received_events_url":"https://api.github.com/users/vkarpov15/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":3,"state":"open","created_at":"2015-08-31T16:59:36Z","updated_at":"2015-09-10T18:07:37Z","due_on":"2015-09-14T04:00:00Z","closed_at":null},"comments":9,"created_at":"2015-09-04T11:01:46Z","updated_at":"2015-09-11T11:10:35Z","closed_at":null,"body":"When using MongooseArray.pull to remove a subdocument from an array using a command such as:\r\n\r\n`someUser.attending.pull({event_id : x, user_id : y})`\r\n\r\nMongoose will remove all subdocuments from the array that either have `event_id` set to `x` OR `user_id` set to `y`.  This is unexpected since MongoDB's `$pull` would remove only subdocuments that have `event_id` set to `x` AND `user_id` set to `y`.\r\n\r\nIf this is a feature, this should be clearly documented."},"comment":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/comments/139517582","html_url":"https://github.com/Automattic/mongoose/issues/3341#issuecomment-139517582","issue_url":"https://api.github.com/repos/Automattic/mongoose/issues/3341","id":139517582,"user":{"login":"c1moore","id":6350063,"avatar_url":"https://avatars.githubusercontent.com/u/6350063?v=3","gravatar_id":"","url":"https://api.github.com/users/c1moore","html_url":"https://github.com/c1moore","followers_url":"https://api.github.com/users/c1moore/followers","following_url":"https://api.github.com/users/c1moore/following{/other_user}","gists_url":"https://api.github.com/users/c1moore/gists{/gist_id}","starred_url":"https://api.github.com/users/c1moore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c1moore/subscriptions","organizations_url":"https://api.github.com/users/c1moore/orgs","repos_url":"https://api.github.com/users/c1moore/repos","events_url":"https://api.github.com/users/c1moore/events{/privacy}","received_events_url":"https://api.github.com/users/c1moore/received_events","type":"User","site_admin":false},"created_at":"2015-09-11T11:10:35Z","updated_at":"2015-09-11T11:10:35Z","body":"We all have one of those nights now and then. :)\r\n\r\nIt seems like this is unexpected behavior based on what @vkarpov15 said and based on the results he was showing (which seemed to be what he expected).  He showed that the `.pull()` only pulled subdocuments that had BOTH fields set to the queried values, but my results above show that the database removes any subdocuments that have any field set to a queried value."}}