These are chat archives for Automattic/mongoose

4th
Sep 2015
Muhammad Zubair
@mzubairsolangi
Sep 04 2015 11:12
hi
Valeri Karpov
@vkarpov15
Sep 04 2015 13:23
@EricMcRay please open up an issue with schemas and example data, too much info for quick gitter question :)
Erinç Fırtına
@EricMcRay
Sep 04 2015 14:02

@vkarpov15 yes I know, I am going to do that when I have free time. But right now I have an other question :D

{
content: String,
comments: [{
text: String,
user: ObjectId,
userType: String,
}]
}

My scheme is like this. I want to populate comments user by userType. I store model name at userType field. How can I do this?

Valeri Karpov
@vkarpov15
Sep 04 2015 17:32
Set refPath to comments.userType, see Automattic/mongoose#2640 for examples. dynref is not really well documented atm, but that should work. @chetverikov would know more, he wrote it and pushed it through :)