DynamicRecord(options)

new DynamicRecord(options)

Creates a new DynamicRecord instance.

Parameters:
Name Type Description
options object
Properties
Name Type Description
tableSlug string

The slug of the table. Must be lowercase only and not containing any whitespace

Classes

Model

Methods

all() → {Promise}

Return all entries from the table.

Returns:
Promise -

Return promise of DynamicCollection.

closeConnection()

Close the connection to the database server. Only used to terminate the running node instance.

findBy(query) → {Promise}

Find the latest entry in the table that match the query.

Parameters:
Name Type Description
query object

A key value pair that will be used to match for entry in the database

Returns:
Promise -

Return promise of DynamicRecord.Model

first() → {Promise}

Return the first entry in the table.

Returns:
Promise -

Return promise of DynamicRecord.Model

where(query, orderBy) → {Promise}

Find all the entries in the table that match the query.

You can sort the returned data by providing a string key to sort the data by or a sorting function to manually sort the data. By default they are sorted in the order they are in in the database.

Parameters:
Name Type Description
query object

A key value pair that will be used to match for entries

orderBy string | function

The key to sort by or a sorting function

Returns:
Promise -

Return promise of DynamicCollection