DynamicRecord.Model

Constructor

new DynamicRecord.Model()

Create a new DynamicRecord.Model instance.

Parameters:

  • data: object - Object containing data for this instance of DynamicRecord.Model

Properties

data: object

The data contained in this instance. It is not kept in sync with the database automatically.

You should be directly modifying this object. When done and you wish to save the data to the database, call save() on the parent object instance.


Methods

save → Promise

Save the data in this instance to the database.

If you have a series of models of the same schema, it is recommended to put them in a DynamicCollection and calling saveAll() on it instead of attempting to save them all in parallel. This applies to schemas with auto incrementing counters.

Returns:

Promise - Return promise of this DynamicRecord.Model instance

destroy → Promise

Delete the entry this instance links to. Clear the data property of this instance as well.

Returns:

Promise - Return promise of this DynamicRecord.Model instance