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.
The cursor that defines the first result after this partition orundefinedif this is the last partition. The cursor value must be destructured when passed toendBefore()(for example withquery.endBefore(...queryPartition.endBefore)).
{Array<*>} {Array<*>} A cursor value that can be used with orundefinedif this is the last partition.
startAt
getstartAt():unknown[]|undefined;
The cursor that defines the first result for this partition orundefinedif this is the first partition. The cursor value must be destructured when passed tostartAt()(for example withquery.startAt(...queryPartition.startAt)).
[[["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-09-04 UTC."],[],[],null,["# Class QueryPartition (7.11.0)\n\nVersion latestkeyboard_arrow_down\n\n- [7.11.0 (latest)](/nodejs/docs/reference/firestore/latest/firestore/querypartition)\n- [7.9.0](/nodejs/docs/reference/firestore/7.9.0/firestore/querypartition)\n- [7.7.0](/nodejs/docs/reference/firestore/7.7.0/firestore/querypartition)\n- [7.6.0](/nodejs/docs/reference/firestore/7.6.0/firestore/querypartition)\n- [7.5.0](/nodejs/docs/reference/firestore/7.5.0/firestore/querypartition)\n- [7.4.0](/nodejs/docs/reference/firestore/7.4.0/firestore/querypartition)\n- [7.3.1](/nodejs/docs/reference/firestore/7.3.1/firestore/querypartition)\n- [7.2.0](/nodejs/docs/reference/firestore/7.2.0/firestore/querypartition)\n- [7.1.0](/nodejs/docs/reference/firestore/7.1.0/firestore/querypartition)\n- [6.4.1](/nodejs/docs/reference/firestore/6.4.1/firestore/querypartition)\n- [6.3.0](/nodejs/docs/reference/firestore/6.3.0/firestore/querypartition)\n- [6.0.0](/nodejs/docs/reference/firestore/6.0.0/firestore/querypartition)\n- [5.0.2](/nodejs/docs/reference/firestore/5.0.2/firestore/querypartition)\n- [4.15.1](/nodejs/docs/reference/firestore/4.15.1/firestore/querypartition)\n- [4.14.2](/nodejs/docs/reference/firestore/4.14.2/firestore/querypartition)\n- [4.9.8](/nodejs/docs/reference/firestore/4.9.8/firestore/querypartition) \nA 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.\n\nQueryPartition\n\nPackage\n-------\n\n[@google-cloud/firestore](../overview.html)\n\nConstructors\n------------\n\n### (constructor)(_firestore, _collectionId, _converter, _startAt, _endBefore)\n\n constructor(_firestore: Firestore, _collectionId: string, _converter: firestore.FirestoreDataConverter\u003cAppModelType, DbModelType\u003e, _startAt: api.IValue[] | undefined, _endBefore: api.IValue[] | undefined);\n\nConstructs a new instance of the `QueryPartition` class\n\nProperties\n----------\n\n### endBefore\n\n get endBefore(): unknown[] | undefined;\n\nThe 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)`).\n**Example** \n\n\n const query = firestore.collectionGroup('collectionId');\n for await (const partition of query.getPartitions(42)) {\n let partitionedQuery = query.orderBy(FieldPath.documentId());\n if (partition.startAt) {\n partitionedQuery = partitionedQuery.startAt(...partition.startAt);\n }\n if (partition.endBefore) {\n partitionedQuery = partitionedQuery.endBefore(...partition.endBefore);\n }\n const querySnapshot = await partitionedQuery.get();\n console.log(`Partition contained ${querySnapshot.length} documents`);\n }\n\n{Array\\\u003c\\*\\\u003e} {Array\\\u003c\\*\\\u003e} A cursor value that can be used with or `undefined` if this is the last partition.\n\n### startAt\n\n get startAt(): unknown[] | undefined;\n\nThe 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)`).\n**Example** \n\n\n const query = firestore.collectionGroup('collectionId');\n for await (const partition of query.getPartitions(42)) {\n let partitionedQuery = query.orderBy(FieldPath.documentId());\n if (partition.startAt) {\n partitionedQuery = partitionedQuery.startAt(...partition.startAt);\n }\n if (partition.endBefore) {\n partitionedQuery = partitionedQuery.endBefore(...partition.endBefore);\n }\n const querySnapshot = await partitionedQuery.get();\n console.log(`Partition contained ${querySnapshot.length} documents`);\n }\n\n{Array\\\u003c\\*\\\u003e} {Array\\\u003c\\*\\\u003e} A cursor value that can be used with or `undefined` if this is the first partition.\n\nMethods\n-------\n\n### toQuery()\n\n toQuery(): Query\u003cAppModelType, DbModelType\u003e;\n\nReturns a query that only encapsulates the documents for this partition.\n\n**Example** \n\n\n const query = firestore.collectionGroup('collectionId');\n for await (const partition of query.getPartitions(42)) {\n const partitionedQuery = partition.toQuery();\n const querySnapshot = await partitionedQuery.get();\n console.log(`Partition contained ${querySnapshot.length} documents`);\n }\n\n{Query"]]