These are chat archives for Automattic/mongoose

10th
Jan 2017
Zakiir Juman
@zakiirjuman
Jan 10 2017 16:08
@rjVapes, would you mind sharing the code you're using to populate as well?
Zakiir Juman
@zakiirjuman
Jan 10 2017 16:20
and perhaps show the other schema that you're trying to populate from, it looks like you'd be searching for asset id's in the category field of your foreign schema..is that correct?
John Webb
@rjVapes
Jan 10 2017 16:21
I actually just stumbled across the issue. I wasn't calling populate specifically on the virtual. Didn't realize unlike other virtuals it needed to be specifically populated to not be null.
Zakiir Juman
@zakiirjuman
Jan 10 2017 16:22
ok, glad you figured it out :)
John Webb
@rjVapes
Jan 10 2017 16:22
Did notice that you can't remove the field (which is going to be duplicated) that you used to populate via select though or it turns the object null. Makes sense why it happens, not sure if it's intentional though.
for instance, i couldn't create a select on the populate in that example that excludes category or my result would be null
but just glad to have the populate working, thanks for the response though :)
Zakiir Juman
@zakiirjuman
Jan 10 2017 16:25
I haven't really fiddled with the virtual population since the regular population method has been serving my needs.
good luck to ya :+1: