The model of the Datastore. T
must extend from Model
.
The datastore where the operation takes place.
Filter data to use. Defaults to null - do not filter.
Sorting data to use. Defaults to null - do not sort.
The datastore where the operation takes place.
Returns the number of items in the result.
Set the filtering method.
const store = new Datastore<Human>(...)
const items = await store.get().filter((human) => human.age > 18).run()
console.log(items)
Filtering method to use. method
is a user-defined callback,
and it is fired on every object in the database. If the callback returns true
,
object is said to 'pass' the filter, and is added to the final list.
Returns this operation again, to make chaining methods possible.
Returns the first element of the result.
Returns the last element of the result.
Same as sort
Sets the pagination data. Refer to PaginationData to understand how pagination works.
skip
and take
values.
Returns this operation again, to make chaining methods possible.
Same as run.
Runs the operation.
Array of objects that are filtered (if you have set the filter), sorted (if you have set the sorting data) and paginated (if you have set the pagination data).
Sets the skip
.
Refer to paginate for more information.
The value of skip
.
Returns this operation again, to make chaining methods possible.
Set the sorting method.
const store = new Datastore<Human>(...)
const items = await store.get().sort({age: {sort: SortDirection.Ascending}}).run()
console.log(items)
Sorting method to use. method
must be a type of ISort<T>
.
Returns this operation again, to make chaining methods possible.
Sets the take
.
Refer to paginate for more information.
Returns this operation again, to make chaining methods possible.
Same as filter.
Pagination data to use. Defaults to {skip: 0, take: Infinity}
Generated using TypeDoc
This operation gets objects from the database.
Usage
See Datastore.get.