Javascript implementation of MongoDB update operators.
Install the package
npm install @creately/mungo
Import the modify
function from mungo
and call it with the document.
import { modify } from 'mungo'
const doc = { id: 'id', x: 10 }
modify(doc, { $set: { x: 20 } })
console.log(doc)
// { id: 'id', x: 20 }
- $set
- $push
- $pull