πŸ’
Cherry3
Support
  • πŸ₯³Welcome
    • πŸ“•Change Log
  • πŸŽ—οΈModel & Schema
    • πŸͺ‘Usage & Options
  • πŸ’Operators
    • 🧡find()
    • 🧡allRows()
    • 🧡findOne()
    • 🧡findOneAndUpdate()
    • 🧡findOneAndDelete()
    • 🧡findById()
    • 🧡findByIdAndUpdate()
    • 🧡findByIdAndDelete()
    • 🧡insertOne()
    • 🧡insertMany()
    • 🧡updateOne()
    • 🧡updateMany()
    • 🧡deleteOne()
    • 🧡deleteMany()
    • 🧡create() & save()
    • 🧡schemaInfo()
    • 🧡dropCollection()
    • 🧡renameCollection()
    • 🧡renameColumn()
    • 🧡deleteColumn()
    • 🧡distinct()
    • 🧡countDocuments()
    • 🧡inspect()
    • 🧡aggregate()
  • πŸ”§Other Operators
    • πŸ†™Update Operators
      • ⚑$set
      • ⚑$unset
      • ⚑$inc
      • ⚑$dec
      • ⚑$push
      • ⚑$pull
      • ⚑$pop
    • πŸ“‘Filter & Process Operators
      • ⚑$limit
      • ⚑$skip
      • ⚑$sort
      • ⚑$upsert
      • ⚑$multiPull
  • πŸͺSQL Config File
Powered by GitBook
On this page

Was this helpful?

  1. πŸ”§Other Operators
  2. πŸ†™Update Operators

⚑$dec

Name
Usage Type
Description

$dec

Object

$dec Operator Performs Extraction as Addition to Number Type Data.

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

(async () => {

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

})();
Previous$incNext$push

Last updated 1 year ago

Was this helpful?