I've:
User
model (fromUserSchema
)Specialty
model (fromSpecialtySchema
)Session
model (fromSessionSchema
)
User has reference field specialities
:
specialities: [{ type: Schema.Types.ObjectId, ref: 'Specialty' }]
Session has reference field provider
:
provider: { type: Schema.Types.ObjectId, ref: 'Session' }
I want to get list of sessions with populated provider
(User) and deep populated specialities
over provider
.
I'm doing following:
Session
.find()
.populate({
path: 'provider',
model: 'User',
populate: {
path: 'specialities',
model: 'Specialty',
}
})
However the results always return an array of IDS (when I try to access them by provider.specialities
instead of the populated version.
Is specialities a keyword?
I don't know why it's like not populating at all.