These are chat archives for Automattic/mongoose

14th
Jan 2017
realisation
@realisation
Jan 14 2017 00:03
Hey folks, I have a collection that has a user property that refs a User model. when I find all on this model, for some reason the user property is undefined unless I populate it
the user property is, in the database, an ObjectId
but in the model I have with the ref, it's a string
what's up here?
abcdcoder (Harpreet Saini)
@Harpreeit
Jan 14 2017 22:17
Hello friends, is there a way to populate and save more than one ref ObjectId's in a mongoose model? Or modifying the design and executing a nested schema is the only optimum solution? I am using MEAN.js and all my collections have user ObjectId as a common attribute, having hard time designing a nested query and fetching userId from all collections to use it inside a single query. Any reference or help will be very much appreciated. Thanks