{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/2850","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/2850/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/2850/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/2850/events","html_url":"https://github.com/Automattic/mongoose/issues/2850","id":67167091,"number":2850,"title":"New Mongoose and new Mongodb WiredTiger storage engine unique:true not working","user":{"login":"mithralaya","id":2692710,"avatar_url":"https://avatars.githubusercontent.com/u/2692710?v=3","gravatar_id":"","url":"https://api.github.com/users/mithralaya","html_url":"https://github.com/mithralaya","followers_url":"https://api.github.com/users/mithralaya/followers","following_url":"https://api.github.com/users/mithralaya/following{/other_user}","gists_url":"https://api.github.com/users/mithralaya/gists{/gist_id}","starred_url":"https://api.github.com/users/mithralaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mithralaya/subscriptions","organizations_url":"https://api.github.com/users/mithralaya/orgs","repos_url":"https://api.github.com/users/mithralaya/repos","events_url":"https://api.github.com/users/mithralaya/events{/privacy}","received_events_url":"https://api.github.com/users/mithralaya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-08T16:24:36Z","updated_at":"2015-04-08T16:34:59Z","closed_at":null,"body":"Hello Mongoose team,\r\n\r\nVersions I am using\r\n\r\n```\r\nMongoDB: 3.0.1 with --storageEngine wiredTiger enabled\r\nMongoose: 4.0.1\r\n```\r\n\r\nThe model I am trying to make it work\r\n\r\n```\r\nvar Basket = new mongoose.Schema({\r\n    _id: {type: mongoose.Schema.ObjectId, default: mongoose.Types.ObjectId, index: true},\r\n    basketId: {type: Number, unique:true, require:true, index: true},\r\n    storeId: {type: Number, require:true, index: true},\r\n    consumerId: {type: Number, require:false, index: true}\r\n});\r\n\r\nmodule.exports = mongoose.model('Basket', Basket);\r\n```\r\n**Note:** basketId is marked as unique:true with index enabled\r\n\r\nI have a brand new install of new mongoDB with wiredtiger. \r\n\r\nNo DB created nor records.\r\n\r\nWhen I try to insert duplicates it inserts to the DB. **unique: true does not work.**\r\n\r\nPlease help with this error. I suspect my code is right. Please let me know if anything is wrong in my code.\r\n\r\nMany thanks,\r\nKarthik\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/comments/90968791","html_url":"https://github.com/Automattic/mongoose/issues/2850#issuecomment-90968791","issue_url":"https://api.github.com/repos/Automattic/mongoose/issues/2850","id":90968791,"user":{"login":"Swissbite","id":205621,"avatar_url":"https://avatars.githubusercontent.com/u/205621?v=3","gravatar_id":"","url":"https://api.github.com/users/Swissbite","html_url":"https://github.com/Swissbite","followers_url":"https://api.github.com/users/Swissbite/followers","following_url":"https://api.github.com/users/Swissbite/following{/other_user}","gists_url":"https://api.github.com/users/Swissbite/gists{/gist_id}","starred_url":"https://api.github.com/users/Swissbite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Swissbite/subscriptions","organizations_url":"https://api.github.com/users/Swissbite/orgs","repos_url":"https://api.github.com/users/Swissbite/repos","events_url":"https://api.github.com/users/Swissbite/events{/privacy}","received_events_url":"https://api.github.com/users/Swissbite/received_events","type":"User","site_admin":false},"created_at":"2015-04-08T16:34:59Z","updated_at":"2015-04-08T16:34:59Z","body":"Just an idea: Try without _id definition. This is done by mongoose."}}