These are chat archives for Automattic/mongoose

27th
Jul 2018
Gerald
@campanagerald
Jul 27 2018 01:24
hi guys, how can I do bulk update then return the updated documents in mongoose. I tried updateMany() doesnt return the updated documents. thanks in advance.
Tinjo Thomas
@tinjothomas
Jul 27 2018 08:57
Hi guys, I would like to know how to create one to many relation ships with different schema set up. Lets say I have one collection called Products, second collection called category, and other called subcategory. Basically I want to link items in the products collection to one or many items in the sub category collection. and subcategory should be associated with category collection.
Kev
@lineus
Jul 27 2018 09:51
@campanagerald you can create a static method on the Model that uses updateMany and find together to accomplish what you want. Here is a simple example
@flkeysils did you get your problem sorted out?
Kev
@lineus
Jul 27 2018 10:28
@tinjothomas I think I might have misunderstood your question, but this gist might help ( at least with the syntax )