These are chat archives for Automattic/mongoose

31st
Aug 2018
Andrey Gazhala
@AndreyGazhala
Aug 31 2018 08:12
Hello to all. I call findOneAndUpdate method but it return old document. How can I return updated document?
Kev
@lineus
Aug 31 2018 09:16
@AndreyGazhala you need to pass the option { new: true } to findOneAndUpdate(cond, update, options) in the options parameter.
Andrey Gazhala
@AndreyGazhala
Aug 31 2018 09:37
@lineus Thank you a lot!
Kev
@lineus
Aug 31 2018 09:47
anytime @AndreyGazhala :smile:
hillct
@hillct
Aug 31 2018 15:46
@lineus thanks. In my above case, I had a typo in some related code which was yielding invalid ID input values
Sean Lavine
@freewil
Aug 31 2018 20:52
does mongoose do something special if you call push() on a Document array?
… like if you do mydoc.arr.push() vs mydoc.arr = [v1, v2] does it use $push vs $set?