Skip to content

Data manipulation

Inserting data

To insert data into a collection, use the .insert() method.

js
const id = collection.insert({ title: 'Hello World' })

Updating data

To update data in a collection, use the .updateOne() or .updateMany() method. SignalDB uses the mingo library under the hood. It allows modifiers that are very similar to MongoDB modifiers. Check out their documentation to learn how a modifier should look like: https://github.com/kofrasa/mingo#updating-documents

js
collection.updateOne({ id: 'xyz' }, {
  $set: { title: 'Hello SignalDB' },
})
collection.updateMany({ title: 'Hello World' }, {
  $set: { title: 'Hello SignalDB' },
})

Deleting data

To delete data from a collection, use the .removeOne() or .removeMany() method.

js
collection.removeOne({ id: 'xyz' })
collection.removeMany({ title: 'Hello World' })

Released under the MIT License.