{"action":"created","issue":{"url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/101","repository_url":"https://api.github.com/repos/OpenKitten/MongoKitten","labels_url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/101/labels{/name}","comments_url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/101/comments","events_url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/101/events","html_url":"https://github.com/OpenKitten/MongoKitten/issues/101","id":215136999,"number":101,"title":"Insert of multiple documents with errors","user":{"login":"tib","id":330813,"avatar_url":"https://avatars0.githubusercontent.com/u/330813?v=3","gravatar_id":"","url":"https://api.github.com/users/tib","html_url":"https://github.com/tib","followers_url":"https://api.github.com/users/tib/followers","following_url":"https://api.github.com/users/tib/following{/other_user}","gists_url":"https://api.github.com/users/tib/gists{/gist_id}","starred_url":"https://api.github.com/users/tib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tib/subscriptions","organizations_url":"https://api.github.com/users/tib/orgs","repos_url":"https://api.github.com/users/tib/repos","events_url":"https://api.github.com/users/tib/events{/privacy}","received_events_url":"https://api.github.com/users/tib/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2017-03-17T22:22:38Z","updated_at":"2017-03-20T19:08:04Z","closed_at":null,"body":"The insert method won't return any object ids, if a duplicate key error happens, but it throws an error. \r\n\r\nThis behaviour would be acceptable if the stoppingOnError parameter is true, but this parameter suggests that if the insertion contains a \"bad object\", the work continues, and the result outcome should be the array of the inserted identifiers. \r\n\r\n```swift\r\ndo {\r\n    let identifiers = try collection.insert(documents, stoppingOnError: false)\r\n}\r\ncatch {\r\n    //this is gona be called... :(\r\n    print(error) \r\n}\r\n```\r\n\r\nIs is possible to get back the inserted identifiers after the error happens?\r\n\r\nThe ideal solution would be to alternate the insert function behaviour, and check the stoppingOnError property & handle the outcome according to it. Does this make any sense or am I missing something?\r\n\r\n\r\n\r\n<bountysource-plugin>\r\n\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/43164894-insert-of-multiple-documents-with-errors?utm_campaign=plugin&utm_content=tracker%2F29950958&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F29950958&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/comments/287865821","html_url":"https://github.com/OpenKitten/MongoKitten/issues/101#issuecomment-287865821","issue_url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/101","id":287865821,"user":{"login":"Joannis","id":1951674,"avatar_url":"https://avatars1.githubusercontent.com/u/1951674?v=3","gravatar_id":"","url":"https://api.github.com/users/Joannis","html_url":"https://github.com/Joannis","followers_url":"https://api.github.com/users/Joannis/followers","following_url":"https://api.github.com/users/Joannis/following{/other_user}","gists_url":"https://api.github.com/users/Joannis/gists{/gist_id}","starred_url":"https://api.github.com/users/Joannis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Joannis/subscriptions","organizations_url":"https://api.github.com/users/Joannis/orgs","repos_url":"https://api.github.com/users/Joannis/repos","events_url":"https://api.github.com/users/Joannis/events{/privacy}","received_events_url":"https://api.github.com/users/Joannis/received_events","type":"User","site_admin":false},"created_at":"2017-03-20T19:08:04Z","updated_at":"2017-03-20T19:08:04Z","body":"Swift 3.0.2-RELEASE has some random troubles inferring the type at that line of code. I fixed it in 3.2.1"}}
{"actor":{"display_login":"Joannis"}}