$inc

Name
Usage Type
Description

$inc

Object

$inc Operator Performs Addition as Addition to Number Type Data.

/* Example Usage */
const model = ...Someone Model

(async () => {

await model.findOneAndUpdate({ name: "Test", age: 20 },{ $inc:{ age: 2 } });
/*
The "age" value that was 20 is now 22
*/

})();

Last updated