The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/firestore > lite > limitToLast

limitToLast() function

Creates a QueryConstraint that only returns the last matching documents.

You must specify at least one orderBy clause for limitToLast queries, otherwise an exception will be thrown during execution.

Signature:

export declare function limitToLast(limit: number): QueryConstraint;

Parameters

Parameter Type Description
limit number The maximum number of items to return.

Returns:

QueryConstraint

The created Query.