.add()

Adds the provided value to the value of the provided key. If no existing number, the provided value will be added to 0 (zero).

add(key, value)

db.get('balance'); // 350

db.add('balance', 500); // 850

Also allows the use of dot notation:

db.get('account'); // { owner: '5antos', balance: 800 }

db.add('account.balance', 200); // { owner: '5antos', balance: 1000 }

Last updated