Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create array of enums #661

Closed
ovaillancourt opened this issue Dec 22, 2011 · 14 comments
Closed

Create array of enums #661

ovaillancourt opened this issue Dec 22, 2011 · 14 comments
Labels
new feature This change adds new functionality, like a new method or class
Milestone

Comments

@ovaillancourt
Copy link

Creating an array of enum doesn't appear to be implemented, would be nice to have!

var mySchema = new Schema({
  label: [{type:String, enum: ['enumVal1','enumVal2']}]
});

Small snippet of conversation on irc which might give direction:

aheckmann: file an issue, i think its b/c the validation isn't set on the array
@aheckmann
Copy link
Collaborator

@wavded
Copy link

wavded commented May 6, 2014

@aheckmann any reason this sort of thing isn't built into mongoose? threw me off recently as I expected it to work the same as if it was a non-array field

@onemenny
Copy link

onemenny commented Jul 1, 2014

same here (3.8.8) - are there any plans to implement this?

@vkarpov15 vkarpov15 added this to the 4.0 milestone Jul 3, 2014
@vkarpov15
Copy link
Collaborator

Not at the moment, but I think this is something that should make it into 4.0.

@arliber
Copy link

arliber commented Sep 29, 2014

Exactly what I was looking for, I hope it will make it into 4.0

@podoler
Copy link

podoler commented Sep 29, 2014

+1

5 similar comments
@rpalanki
Copy link

rpalanki commented Oct 3, 2014

+1

@j-jiafei
Copy link

j-jiafei commented Oct 6, 2014

+1

@valentinkostadinov
Copy link

+1

@lvivier
Copy link

lvivier commented Nov 6, 2014

+1

@jamlfy
Copy link

jamlfy commented Nov 7, 2014

+1

@hankchiutw
Copy link

I use something like

roles: { 
    type: [{ type: String, enum: [ 'resident', 'distributor', 'company', 'moderator', 'admin' ] }],
    default: 'resident'
}

to set default value.

@cloud-tribal
Copy link

What's the status on this ?

@vkarpov15
Copy link
Collaborator

@cloud-tribal well the issue is closed with 3.9.6 as the milestone, so I'd imagine that means it was released in 3.9.6. If you're using 4.x you should be able to access this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature This change adds new functionality, like a new method or class
Projects
None yet
Development

No branches or pull requests