.subtract()
Subtracts the provided value from the value of the provided key. If no existing number, the provided value will be subtracted from 0 (zero).
subtract(key, value)
db.get('balance'); // 350
db.subtract('balance', 100); // 250
Also allows the use of dot notation:
db.get('account'); // { owner: '5antos', balance: 800 }
db.subtract('account.balance', 200); // { owner: '5antos', balance: 600 }
Last updated
Was this helpful?