AFilterrepresents a restriction on one or more field values and can be used to refine the results of aQuery.Filterss are created by invoking , , or and can then be passed to to create a newQueryinstance that also contains thisFilter.
Creates and returns a new [Filter]Filterthat is a conjunction of the givenFilters. A conjunction filter includes a document if it satisfies all of the givenFilters.
The returned Filter can be applied to [Query.where()], [Filter.or()], or [Filter.and()]. When applied to a [Query]Queryit requires that documents must satisfy one of the providedFilters.
Creates and returns a new [Filter]Filterthat is a disjunction of the givenFilters. A disjunction filter includes a document if it satisfies any of the givenFilters.
The returned Filter can be applied to [Query.where()], [Filter.or()], or [Filter.and()]. When applied to a [Query]Queryit requires that documents must satisfy one of the providedFilters.
Creates and returns a new [Filter]Filter, which can be applied to [Query.where()], [Filter.or()], or [Filter.and()]. When applied to a [Query]Queryit requires that documents must contain the specified field and that its value should satisfy the relation constraint provided.
Parameters
Name
Description
fieldPath
string |FirebaseFirestore.FieldPath
The name of a property value to compare.
opStr
firestore.WhereFilterOp
A comparison operation in the form of a string. Acceptable operator strings are "<", "<=", "==", "!=", ">=", ">", "array-contains", "in", "not-in", and "array-contains-any".
value
unknown
The value to which to compare the field for inclusion in a query.
[[["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 Filter (7.11.0)\n\nVersion latestkeyboard_arrow_down\n\n- [7.11.0 (latest)](/nodejs/docs/reference/firestore/latest/firestore/filter)\n- [7.9.0](/nodejs/docs/reference/firestore/7.9.0/firestore/filter)\n- [7.7.0](/nodejs/docs/reference/firestore/7.7.0/firestore/filter)\n- [7.6.0](/nodejs/docs/reference/firestore/7.6.0/firestore/filter)\n- [7.5.0](/nodejs/docs/reference/firestore/7.5.0/firestore/filter)\n- [7.4.0](/nodejs/docs/reference/firestore/7.4.0/firestore/filter)\n- [7.3.1](/nodejs/docs/reference/firestore/7.3.1/firestore/filter)\n- [7.2.0](/nodejs/docs/reference/firestore/7.2.0/firestore/filter)\n- [7.1.0](/nodejs/docs/reference/firestore/7.1.0/firestore/filter)\n- [6.4.1](/nodejs/docs/reference/firestore/6.4.1/firestore/filter)\n- [6.3.0](/nodejs/docs/reference/firestore/6.3.0/firestore/filter)\n- [6.0.0](/nodejs/docs/reference/firestore/6.0.0/firestore/filter)\n- [5.0.2](/nodejs/docs/reference/firestore/5.0.2/firestore/filter)\n- [4.15.1](/nodejs/docs/reference/firestore/4.15.1/firestore/filter)\n- [4.14.2](/nodejs/docs/reference/firestore/4.14.2/firestore/filter)\n- [4.9.8](/nodejs/docs/reference/firestore/4.9.8/firestore/filter) \nA `Filter` represents a restriction on one or more field values and can be used to refine the results of a [Query](/nodejs/docs/reference/firestore/latest/firestore/query). `Filters`s are created by invoking , , or and can then be passed to to create a new [Query](/nodejs/docs/reference/firestore/latest/firestore/query) instance that also contains this `Filter`.\n\nPackage\n-------\n\n[@google-cloud/firestore](../overview.html)\n\nMethods\n-------\n\n### and(filters)\n\n static and(...filters: Filter[]): Filter;\n\nCreates and returns a new \\[Filter\\][Filter](/nodejs/docs/reference/firestore/latest/firestore/filter) that is a conjunction of the given [Filter](/nodejs/docs/reference/firestore/latest/firestore/filter)s. A conjunction filter includes a document if it satisfies all of the given [Filter](/nodejs/docs/reference/firestore/latest/firestore/filter)s.\n\nThe returned Filter can be applied to \\[Query.where()\\], \\[Filter.or()\\], or \\[Filter.and()\\]. When applied to a \\[Query\\][Query](/nodejs/docs/reference/firestore/latest/firestore/query) it requires that documents must satisfy one of the provided [Filter](/nodejs/docs/reference/firestore/latest/firestore/filter)s.\n\n**Example** \n\n\n let collectionRef = firestore.collection('col');\n\n // doc.foo == 'bar' && doc.baz \u003e 0\n let andFilter = Filter.and(Filter.where('foo', '==', 'bar'), Filter.where('baz', '\u003e', 0));\n\n collectionRef.where(andFilter).get().then(querySnapshot =\u003e {\n querySnapshot.forEach(documentSnapshot =\u003e {\n console.log(`Found document at ${documentSnapshot.ref.path}`);\n });\n });\n\n### or(filters)\n\n static or(...filters: Filter[]): Filter;\n\nCreates and returns a new \\[Filter\\][Filter](/nodejs/docs/reference/firestore/latest/firestore/filter) that is a disjunction of the given [Filter](/nodejs/docs/reference/firestore/latest/firestore/filter)s. A disjunction filter includes a document if it satisfies any of the given [Filter](/nodejs/docs/reference/firestore/latest/firestore/filter)s.\n\nThe returned Filter can be applied to \\[Query.where()\\], \\[Filter.or()\\], or \\[Filter.and()\\]. When applied to a \\[Query\\][Query](/nodejs/docs/reference/firestore/latest/firestore/query) it requires that documents must satisfy one of the provided [Filter](/nodejs/docs/reference/firestore/latest/firestore/filter)s.\n\n**Example** \n\n\n let collectionRef = firestore.collection('col');\n\n // doc.foo == 'bar' || doc.baz \u003e 0\n let orFilter = Filter.or(Filter.where('foo', '==', 'bar'), Filter.where('baz', '\u003e', 0));\n\n collectionRef.where(orFilter).get().then(querySnapshot =\u003e {\n querySnapshot.forEach(documentSnapshot =\u003e {\n console.log(`Found document at ${documentSnapshot.ref.path}`);\n });\n });\n\n### where(fieldPath, opStr, value)\n\n static where(fieldPath: string | firestore.FieldPath, opStr: firestore.WhereFilterOp, value: unknown): Filter;\n\nCreates and returns a new \\[Filter\\][Filter](/nodejs/docs/reference/firestore/latest/firestore/filter), which can be applied to \\[Query.where()\\], \\[Filter.or()\\], or \\[Filter.and()\\]. When applied to a \\[Query\\][Query](/nodejs/docs/reference/firestore/latest/firestore/query) it requires that documents must contain the specified field and that its value should satisfy the relation constraint provided.\n\n**Example** \n\n\n let collectionRef = firestore.collection('col');\n\n collectionRef.where(Filter.where('foo', '==', 'bar')).get().then(querySnapshot =\u003e {\n querySnapshot.forEach(documentSnapshot =\u003e {\n console.log(`Found document at ${documentSnapshot.ref.path}`);\n });\n });"]]