var Stuff = new mongoose.Schema({
name: String,
expiration: Date,
cost: Number
});
var Container = new mongoose.Schema({
stuff: { type: String, ref: 'stuff' },
});
var ContainerWrapper = new mongoose.Schema({
container: [[container]] // array of arrays
});
ContainerWrapper document
{
container: [
[
{stuff: 'ID1'},
{stuff: 'ID2'},
],
[
{stuff: 'ID3'},
{stuff: 'ID4'},
{stuff: 'ID5'},
]
]
}
How can I get the population of stuff? I've tried variations of the code below
ContainerWrapper.find({}).populate({path: 'container.stuff'})
But none seems to be working.
Any help is appreciated!