Can MongoDB allow updating a number field using another number field in same document ? Let say I have a document like below :
{
"_id" : "1",
"a" : 2,
"b" : 3
}
a and b fields are number fields(decimal,int...) my goal is update field b using field a How can I set b like b = 2*a. Is this possible ?
3.6you don't have an option to direct update, You need to first read & then update !! For v4.2you can do it in one call !! Anyway3.6is so old better upgrade your version asap..