db Object
  • Updated on 16 Mar 2020
  • 1 minute to read
  • Contributors
  • Print
  • Share
  • Dark
    Light

db Object

  • Print
  • Share
  • Dark
    Light

The db Object can be accessed from within the state Object and offers a number of methods to perform operations in cloud persistent storage.

Methods

getTransactionData(query, scan, pagination, sort)

This method allows users to get transactional data stored within our persisten database in the backend.

writeTransactionData(documents)

This method allows users to store transactional data within our backend. In the usage below you can see an example on the usage.
The fields "entity" and "key" are required.

let newBooking = {
      document: {
      entity: 'bookins',
      key: 'myBookingId', //or whatever unique identifier,
      ...
      rest of the fields
    }
  }
  await botState.db.writeTransactionData([newBooking])

deleteTransactionData(query)

This method allows users to delete transactional data within our backend.

Was this article helpful?