These are chat archives for Automattic/mongoose

11th
Mar 2018
Sedric Heidarizarei
@saeedhei
Mar 11 2018 21:25
Kev
@lineus
Mar 11 2018 23:07
you could add a field to the personSchema that is an array of refs to other users I suppose
@saeedhei ^
Sedric Heidarizarei
@saeedhei
Mar 11 2018 23:17
@lineus You Mean like This: const User = new Person({ _id: '20', tok: '54cfg59ks9hf9ht', name: 'Sarah', pwd: 'Sarah202020', gender: 'Female', blacklist: { _id: '23', _id: '70', _id: '27', }, }); Is this okey?
Kev
@lineus
Mar 11 2018 23:27
@saeedhei I updated your stackoverflow question with how I would do it. The reference will only store the objectId for the user to block and if you need to grab data associated with a user from the reference you can use mongoose's populate to grab what you need. The query interface is pretty awesome :)
Sedric Heidarizarei
@saeedhei
Mar 11 2018 23:32
Thank you 🌸
Kev
@lineus
Mar 11 2018 23:33
any time @saeedhei !