Reputation: 147
I want to add a field to a schema which includes dash character (-
) in it. Mongoose is not allowing it. Is this possible or not?
var mySchema = new Schema({
family-name: {
type: String,
default: ''
}
});
Upvotes: 1
Views: 1135
Reputation: 57954
Just add quotes around the property name:
var mySchema = new Schema({
'family-name': {
type: String,
default: ''
}
});
Upvotes: 5