I have a collection(matches) of data with one virtual property referencing another collection(rosters). Collection(rosters) has a reference to another virtual property in collection(participants). I have successfully populated collection(rosters). However, I am unable to populate collection(participants).
Matches
{
"_id": {
"$oid": "5c1b99843a71d812af25b10d"
},
"type": "match",
"id": "0b0ad010-ee86-11e8-b29a-061fc5dc976c",
"relationships": {
"rosters": {
"data": [
{
"type": "roster",
"id": "8dc6f770-ee88-11e8-b755-9d41e8e54ecc"
},
{
"type": "roster",
"id": "8dc6f774-ee88-11e8-b755-9d41e8e54ecc"
}
]
}
}
}
Rosters
"_id": {
"$oid": "5c1b99843a71d812af25b151"
},
"type": "roster",
"id": "f51f1250-ee87-11e8-a185-711497405867",
"relationships": {
"participants": {
"data": [
{
"type": "participant",
"id": "f51f1251-ee87-11e8-a185-711497405867"
},
{
"type": "participant",
"id": "f51f1252-ee87-11e8-a185-711497405867"
},
{
"type": "participant",
"id": "f51f1253-ee87-11e8-a185-711497405867"
}
]
}
}
Here is what I have so far.
Match.find([])
.populate({
path: 'rosters', // virtual
populate: {
path: 'participant', // virtual
model: 'Participant'
}
}
I expect to have a populated participant instance within my match instance, however the actual output is: participants: { data: [Array] }.