These are chat archives for Automattic/mongoose

Jan 2017
Zakiir Juman
Jan 08 2017 00:20

hi everyone, I've got a document a that looks like:

{ field_1: 0, field_2: 0}

If I change a variable like this:

a.field_1 = 1;;
and before the save finishes, I also do:
a.field_2 = 1;;
do I run the risk of some kind of race condition?
or will my returned document still come out as expected:
{field_1: 1, field_2: 1}
Zakiir Juman
Jan 08 2017 00:29
I've tried it locally and it always seems to work, but I just wanted to make sure that whatever is inputted locally actually takes precedence to any returned document fields.