{"action":"created","issue":{"url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/71","repository_url":"https://api.github.com/repos/OpenKitten/MongoKitten","labels_url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/71/comments","events_url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/71/events","html_url":"https://github.com/OpenKitten/MongoKitten/issues/71","id":194398350,"node_id":"MDU6SXNzdWUxOTQzOTgzNTA=","number":71,"title":"Not returning error when index clash","user":{"login":"gabriellanata","id":585835,"node_id":"MDQ6VXNlcjU4NTgzNQ==","avatar_url":"https://avatars2.githubusercontent.com/u/585835?v=4","gravatar_id":"","url":"https://api.github.com/users/gabriellanata","html_url":"https://github.com/gabriellanata","followers_url":"https://api.github.com/users/gabriellanata/followers","following_url":"https://api.github.com/users/gabriellanata/following{/other_user}","gists_url":"https://api.github.com/users/gabriellanata/gists{/gist_id}","starred_url":"https://api.github.com/users/gabriellanata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabriellanata/subscriptions","organizations_url":"https://api.github.com/users/gabriellanata/orgs","repos_url":"https://api.github.com/users/gabriellanata/repos","events_url":"https://api.github.com/users/gabriellanata/events{/privacy}","received_events_url":"https://api.github.com/users/gabriellanata/received_events","type":"User","site_admin":false},"labels":[{"id":316926219,"node_id":"MDU6TGFiZWwzMTY5MjYyMTk=","url":"https://api.github.com/repos/OpenKitten/MongoKitten/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":{"login":"Joannis","id":1951674,"node_id":"MDQ6VXNlcjE5NTE2NzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1951674?v=4","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},"assignees":[{"login":"Joannis","id":1951674,"node_id":"MDQ6VXNlcjE5NTE2NzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1951674?v=4","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}],"milestone":null,"comments":20,"created_at":"2016-12-08T17:37:43Z","updated_at":"2018-09-24T07:48:30Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"When a collection has a unique index and I try to add an object which would clash with an existing object, MongoKitten does not throw an error, but the object is not added.\r\n\r\n**Steps to reproduce:**\r\n\r\n1. Create a database with a unique index on a field (in the example it is field \"value\")\r\n```\r\n{\r\n  \"unique\": true,\r\n  \"key\": { \"value\": 1 }\r\n}\r\n```\r\n\r\n2. Add an object with value \"A\"\r\n```\r\nlet document: MongoKitten.Document = [\r\n      \"value\": \"A\"\r\n]\r\ntry MongoManager.database[\"tests\"].insert(document)\r\n```\r\n\r\n3. Verify document was inserted\r\n```\r\n[{\"value\":\"A\",\"_id\":\"bb964958d7260b8fbaf1a0e8\"}]\r\n```\r\n\r\n4. Add a second object with value \"A\"\r\n```\r\nlet document: MongoKitten.Document = [\r\n      \"value\": \"A\"\r\n]\r\ntry MongoManager.database[\"tests\"].insert(document)\r\n```\r\n\r\n5. Verify document was inserted (fails, only original document exists, but no error thrown by MongoKitten)\r\n```\r\n[{\"value\":\"A\",\"_id\":\"bb964958d7260b8fbaf1a0e8\"}]\r\n```\r\n\r\n\r\n**Other details**\r\n\r\nIf this same steps are done directly in mongo an error is returned as expected."},"comment":{"url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/comments/423897815","html_url":"https://github.com/OpenKitten/MongoKitten/issues/71#issuecomment-423897815","issue_url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/71","id":423897815,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzg5NzgxNQ==","user":{"login":"clmntcrl","id":5878910,"node_id":"MDQ6VXNlcjU4Nzg5MTA=","avatar_url":"https://avatars3.githubusercontent.com/u/5878910?v=4","gravatar_id":"","url":"https://api.github.com/users/clmntcrl","html_url":"https://github.com/clmntcrl","followers_url":"https://api.github.com/users/clmntcrl/followers","following_url":"https://api.github.com/users/clmntcrl/following{/other_user}","gists_url":"https://api.github.com/users/clmntcrl/gists{/gist_id}","starred_url":"https://api.github.com/users/clmntcrl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clmntcrl/subscriptions","organizations_url":"https://api.github.com/users/clmntcrl/orgs","repos_url":"https://api.github.com/users/clmntcrl/repos","events_url":"https://api.github.com/users/clmntcrl/events{/privacy}","received_events_url":"https://api.github.com/users/clmntcrl/received_events","type":"User","site_admin":false},"created_at":"2018-09-24T07:48:30Z","updated_at":"2018-09-24T07:48:30Z","author_association":"NONE","body":"IMHO you have already answer to the question of multi-document insertion [here](https://github.com/OpenKitten/MongoKitten/issues/101#issuecomment-288015412) on issue #101."}}
{"actor":{"display_login":"clmntcrl"}}