{"action":"closed","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/6239","repository_url":"https://api.github.com/repos/Automattic/mongoose","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/6239/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/6239/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/6239/events","html_url":"https://github.com/Automattic/mongoose/issues/6239","id":304916546,"number":6239,"title":"Bug Report: Can't use an array variable with enum","user":{"login":"haydaralrikabi","id":5257403,"avatar_url":"https://avatars1.githubusercontent.com/u/5257403?v=4","gravatar_id":"","url":"https://api.github.com/users/haydaralrikabi","html_url":"https://github.com/haydaralrikabi","followers_url":"https://api.github.com/users/haydaralrikabi/followers","following_url":"https://api.github.com/users/haydaralrikabi/following{/other_user}","gists_url":"https://api.github.com/users/haydaralrikabi/gists{/gist_id}","starred_url":"https://api.github.com/users/haydaralrikabi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haydaralrikabi/subscriptions","organizations_url":"https://api.github.com/users/haydaralrikabi/orgs","repos_url":"https://api.github.com/users/haydaralrikabi/repos","events_url":"https://api.github.com/users/haydaralrikabi/events{/privacy}","received_events_url":"https://api.github.com/users/haydaralrikabi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-03-13T20:07:48Z","updated_at":"2018-03-18T12:16:41Z","closed_at":"2018-03-18T12:16:41Z","author_association":"NONE","body":"Hi,\r\nThe following enum validation is ignored:\r\n\r\n> `myArray = [\"one\", \"two\", \"three\"];`\r\n> \r\n> `const numbers = new mongoose.Schema({`\r\n`range: { type: String, enum: myArray }`\r\n`});`\r\n\r\nHowever, using the array explicitly with enum works, e.g:\r\n> `range: { type: String, enum: [\"one\", \"two\", \"three\"] }`\r\n\r\nI searched up and down for a solution but I couldn't find one.\r\n\r\nI am currently using:\r\nNode.js@v9.8.0\r\nmongoose@5.0.9\r\nMongoDB@2.6.10\r\n\r\nThank you in anticipation."}}
{"actor":{"display_login":"haydaralrikabi"}}