O
O
olezhenka2018-04-26 19:14:52
MongoDB
olezhenka, 2018-04-26 19:14:52

How to make population in mongoose document?

How can I make such a population?

User.find({id: 123}, function(err, user) {
  user.populate('vk_account').populate('ok_account')...
})

or do you have to do it like this?
User.find({id: 123}, function(err, user) {
  vk_account.find({user_id: 123})
  ok_account.find({user_id: 123})
  ...
})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RidgeA, 2018-04-26
@RidgeA

How about reading the mongoosejs.com/docs/populate.html documentation ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question