Delete records

The delete method is used to remove records from the dataset.  It has to be used with the where method and a filter criteria so we know what to delete. In  order to select a field, you need to import the Field Module first. Creating a filter using the conditional methods below provide you with a lot of flexibility on when a record should be deleted.

You can use the following conditional methods to create a filter:

  • isGreaterThan
  • isLessThan
  • isEqualTo
  • isDifferentFrom
  • isEqualOrGreaterThan
  • isEqualOrLessThan
  • isNull
  • isNotNull
  • isInArray
  • isNotInArray
  • isLike
  • satisfiesRegexp
  • isBetween


import { field } from "SDK location"

let posts = dataModule.dataset("posts");
posts.delete().where(field("title").isLike("test")).execute().then( (records) => {
  // you will be able to access the deleted records here
  // they won't be stored in the DB anymore, but maybe you
  // want to display a visual confirmation of what got deleted
}).catch( (error) => {
  // you can see the error info here, if something goes wrong

Advanced users:

In order to obtain deeper insights, please visit the API reference