Skip to main content

Interface: OrderedQuery<TableInfo>

server.OrderedQuery

A Query with an order that has already been defined.

Type parameters

NameType
TableInfoextends GenericTableInfo

Hierarchy

Methods

[asyncIterator]

[asyncIterator](): AsyncIterator<DocumentByInfo<TableInfo>, any, undefined>

Returns

AsyncIterator<DocumentByInfo<TableInfo>, any, undefined>

Inherited from

AsyncIterable.__@asyncIterator@3539


filter

filter(predicate): OrderedQuery<TableInfo>

Filter the query output, returning only the values for which predicate evaluates to true.

Parameters

NameTypeDescription
predicate(q: FilterBuilder<TableInfo>) => Expression<boolean>An Expression constructed with the supplied FilterBuilder that specifies which documents to keep.

Returns

OrderedQuery<TableInfo>


collect

collect(): Promise<DocumentByInfo<TableInfo>[]>

Execute the query and return all of the results as an array.

Note: when processing a query with a lot of results, it's often better to use the Query as an AsyncIterable instead.

Returns

Promise<DocumentByInfo<TableInfo>[]>

  • An array of all of the query's results.

take

take(n): Promise<DocumentByInfo<TableInfo>[]>

Execute the query and return the first n results.

Parameters

NameTypeDescription
nnumberThe number of items to take.

Returns

Promise<DocumentByInfo<TableInfo>[]>

  • An array of the first n results of the query (or less if the query doesn't have n results).

first

first(): Promise<null | DocumentByInfo<TableInfo>>

Execute the query and return the first result if there is one.

Returns

Promise<null | DocumentByInfo<TableInfo>>

  • The first value of the query or null if the query returned no results.

unique

unique(): Promise<DocumentByInfo<TableInfo>>

Execute the query and return the singular result.

Throws

Will throw an error if the query returns no results or more than one result.

Returns

Promise<DocumentByInfo<TableInfo>>

  • The single result returned from the query.