Reputation: 4062
I wish to have a Mongoose Schema property contain an array of array of strings, like so
[['one','two','three'],['four','five']]
How should I model this in my Schema? The following doesn't seem to work but it could possibly be another error...
names : [[{type: String, trim: true}]]
Do I have to make a seperate schema as per Nested arrays in Mongoose
Thanks
Upvotes: 1
Views: 2821
Reputation: 4062
Ah, it turns out that nested arrays do have to be put in seperate schemas
var InnerArray = new mongoose.Schema({
set : [{type: String, trim: true}]
})
var Stuff = new mongoose.Schema({
foo : [InnerArray]
})
Upvotes: 2