where → 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:
-
query
: object - A key value pair that will be used to match for entries
-
options
: object - Query options object
-
options.limit
: number - Limit the number of maximum returned entries
-
options.offset
: number - Number of entries to offset by before starting query
-
options.sort
: object - Sorting order of returned entries. Defined by providing the column to sort by as key and "ASC" "DESC" as value for ascending and descending respectively.
Returns:
Promise - Return promise of DynamicCollection instance
first → Promise
Return the first entry in the table. If provided query option
'limit', it will return the first nth entry in the database wrapped in a Promise of DynamicCollection from first inserted forward.
Parameters:
-
options
: object - Query options object
-
options.limit
: number - Specify the number of entries to return. If not defined, defaults to 1.
-
options.offset
: number - Number of entries to offset by before starting query
-
options.sort
: object - Sorting order of returned entries. Defined by providing the column to sort by as key and "ASC" "DESC" as value for ascending and descending respectively.
Returns:
Promise - Return promise of DynamicRecord.Model instance,
DynamicCollection instance, or null
last → Promise
Return the last entry in the table. If provided query option
'limit', it will return the last nth entry in the database wrapped in a Promise of DynamicCollection from last inserted backward.
Parameters:
-
options
: object - Query options object
-
options.limit
: number - Specify the number of entries to return. If not defined, defaults to 1.
-
options.offset
: number - Number of entries to offset by before starting query
-
options.sort
: object - Sorting order of returned entries. Defined by providing the column to sort by as key and "ASC" "DESC" as value for ascending and descending respectively.
Returns:
Promise - Return promise of DynamicRecord.Model instance,
DynamicCollection instance, or null