These are chat archives for Automattic/mongoose

Jul 2017
Paul "Joey" Clark
Jul 25 2017 02:16
@Pudding-Ship You could try: Object.assign(foo, data); and then await;

Alternatively, sometimes we do await Foo.findOneAndUpdate({id: foo._id}, data);

That is just one line, but I think assign() and save() look simpler. (Provided nobody else has updated that DB document in the meantime.)

Note: If data contains the _id of another document, you had better remove that first!

I believe the answer to both @thavlik and @Pudding-Ship’s populate questions is: yes.