1

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

1 Answer 1

2

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]
})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.