A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/nodejs/docs/reference/firestore/latest/firestore/querypartition below:

Class QueryPartition (7.11.0) | Node.js client library

Class QueryPartition (7.11.0)

Stay organized with collections Save and categorize content based on your preferences.

A split point that can be used in a query as a starting and/or end point for the query results. The cursors returned by and can only be used in a query that matches the constraint of query that produced this partition.

QueryPartition

Package@google-cloud/firestore Constructors (constructor)(_firestore, _collectionId, _converter, _startAt, _endBefore)
constructor(_firestore: Firestore, _collectionId: string, _converter: firestore.FirestoreDataConverter<AppModelType, DbModelType>, _startAt: api.IValue[] | undefined, _endBefore: api.IValue[] | undefined);

Constructs a new instance of the QueryPartition class

Parameters Name Description _firestore Firestore
_collectionId string
_converter FirebaseFirestore.FirestoreDataConverter<AppModelType, DbModelType>
_startAt google.firestore.v1.IValue[] | undefined
_endBefore google.firestore.v1.IValue[] | undefined
Properties endBefore
get endBefore(): unknown[] | undefined;

The cursor that defines the first result after this partition or undefined if this is the last partition. The cursor value must be destructured when passed to endBefore() (for example with query.endBefore(...queryPartition.endBefore)).

Example

const query = firestore.collectionGroup('collectionId');
for await (const partition of query.getPartitions(42)) {
  let partitionedQuery = query.orderBy(FieldPath.documentId());
  if (partition.startAt) {
    partitionedQuery = partitionedQuery.startAt(...partition.startAt);
  }
  if (partition.endBefore) {
    partitionedQuery = partitionedQuery.endBefore(...partition.endBefore);
  }
  const querySnapshot = await partitionedQuery.get();
  console.log(`Partition contained ${querySnapshot.length} documents`);
}

{Array<*>} {Array<*>} A cursor value that can be used with or undefined if this is the last partition.

startAt
get startAt(): unknown[] | undefined;

The cursor that defines the first result for this partition or undefined if this is the first partition. The cursor value must be destructured when passed to startAt() (for example with query.startAt(...queryPartition.startAt)).

Example

const query = firestore.collectionGroup('collectionId');
for await (const partition of query.getPartitions(42)) {
  let partitionedQuery = query.orderBy(FieldPath.documentId());
  if (partition.startAt) {
    partitionedQuery = partitionedQuery.startAt(...partition.startAt);
  }
  if (partition.endBefore) {
    partitionedQuery = partitionedQuery.endBefore(...partition.endBefore);
  }
  const querySnapshot = await partitionedQuery.get();
  console.log(`Partition contained ${querySnapshot.length} documents`);
}

{Array<*>} {Array<*>} A cursor value that can be used with or undefined if this is the first partition.

Methods toQuery()
toQuery(): Query<AppModelType, DbModelType>;

Returns a query that only encapsulates the documents for this partition.

Returns Type Description Query<AppModelType, DbModelType> Example

const query = firestore.collectionGroup('collectionId');
for await (const partition of query.getPartitions(42)) {
  const partitionedQuery = partition.toQuery();
  const querySnapshot = await partitionedQuery.get();
  console.log(`Partition contained ${querySnapshot.length} documents`);
}

{Query

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4