Filter

classFilter


AFilter represents a restriction on one or more field values and can be used to refine the results of aQuery.

Summary

Public constructors

Public functions

java-staticFilter
and(filters: Array<Filter!>!)

Creates a new filter that is a conjunction of the given filters.

java-staticFilter
arrayContains(field: String, value: Any?)

Creates a new filter for checking that the given array field contains the given value.

java-staticFilter
arrayContains(fieldPath: FieldPath, value: Any?)

Creates a new filter for checking that the given array field contains the given value.

java-staticFilter
arrayContainsAny(field: String, values: (Mutable)List<Any!>)

Creates a new filter for checking that the given array field contains any of the given values.

java-staticFilter
arrayContainsAny(fieldPath: FieldPath, values: (Mutable)List<Any!>)

Creates a new filter for checking that the given array field contains any of the given values.

java-staticFilter
equalTo(field: String, value: Any?)

Creates a new filter for checking that the given field is equal to the given value.

java-staticFilter
equalTo(fieldPath: FieldPath, value: Any?)

Creates a new filter for checking that the given field is equal to the given value.

java-staticFilter
greaterThan(field: String, value: Any?)

Creates a new filter for checking that the given field is greater than the given value.

java-staticFilter
greaterThan(fieldPath: FieldPath, value: Any?)

Creates a new filter for checking that the given field is greater than the given value.

java-staticFilter
greaterThanOrEqualTo(field: String, value: Any?)

Creates a new filter for checking that the given field is greater than or equal to the given value.

java-staticFilter
greaterThanOrEqualTo(fieldPath: FieldPath, value: Any?)

Creates a new filter for checking that the given field is greater than or equal to the given value.

java-staticFilter
inArray(field: String, values: (Mutable)List<Any!>)

Creates a new filter for checking that the given field equals any of the given values.

java-staticFilter
inArray(fieldPath: FieldPath, values: (Mutable)List<Any!>)

Creates a new filter for checking that the given field equals any of the given values.

java-staticFilter
lessThan(field: String, value: Any?)

Creates a new filter for checking that the given field is less than the given value.

java-staticFilter
lessThan(fieldPath: FieldPath, value: Any?)

Creates a new filter for checking that the given field is less than the given value.

java-staticFilter
lessThanOrEqualTo(field: String, value: Any?)

Creates a new filter for checking that the given field is less than or equal to the given value.

java-staticFilter
lessThanOrEqualTo(fieldPath: FieldPath, value: Any?)

Creates a new filter for checking that the given field is less than or equal to the given value.

java-staticFilter
notEqualTo(field: String, value: Any?)

Creates a new filter for checking that the given field is not equal to the given value.

java-staticFilter
notEqualTo(fieldPath: FieldPath, value: Any?)

Creates a new filter for checking that the given field is not equal to the given value.

java-staticFilter
notInArray(field: String, values: (Mutable)List<Any!>)

Creates a new filter for checking that the given field does not equal any of the given values.

java-staticFilter
notInArray(fieldPath: FieldPath, values: (Mutable)List<Any!>)

Creates a new filter for checking that the given field does not equal any of the given values.

java-staticFilter
or(filters: Array<Filter!>!)

Creates a new filter that is a disjunction of the given filters.

Public constructors

Filter

Filter()

Public functions

and

java-static fun and(filters: Array<Filter!>!): Filter

Creates a new filter that is a conjunction of the given filters. A conjunction filter includes a document if it satisfiesall of the given filters.

Parameters
filters: Array<Filter!>!

The list of filters to perform a conjunction for.

Returns
Filter

The newly created filter.

arrayContains

java-static fun arrayContains(field: String, value: Any?): Filter

Creates a new filter for checking that the given array field contains the given value.

Parameters
field: String

The field used for the filter.

value: Any?

The value used for the filter.

Returns
Filter

The newly created filter.

arrayContains

java-static fun arrayContains(fieldPath: FieldPath, value: Any?): Filter

Creates a new filter for checking that the given array field contains the given value.

Parameters
fieldPath: FieldPath

The field path used for the filter.

value: Any?

The value used for the filter.

Returns
Filter

The newly created filter.

arrayContainsAny

java-static fun arrayContainsAny(field: String, values: (Mutable)List<Any!>): Filter

Creates a new filter for checking that the given array field contains any of the given values.

Parameters
field: String

The field used for the filter.

values: (Mutable)List<Any!>

The list of values used for the filter.

Returns
Filter

The newly created filter.

arrayContainsAny

java-static fun arrayContainsAny(fieldPath: FieldPath, values: (Mutable)List<Any!>): Filter

Creates a new filter for checking that the given array field contains any of the given values.

Parameters
fieldPath: FieldPath

The field path used for the filter.

values: (Mutable)List<Any!>

The list of values used for the filter.

Returns
Filter

The newly created filter.

equalTo

java-static fun equalTo(field: String, value: Any?): Filter

Creates a new filter for checking that the given field is equal to the given value.

Parameters
field: String

The field used for the filter.

value: Any?

The value used for the filter.

Returns
Filter

The newly created filter.

equalTo

java-static fun equalTo(fieldPath: FieldPath, value: Any?): Filter

Creates a new filter for checking that the given field is equal to the given value.

Parameters
fieldPath: FieldPath

The field path used for the filter.

value: Any?

The value used for the filter.

Returns
Filter

The newly created filter.

greaterThan

java-static fun greaterThan(field: String, value: Any?): Filter

Creates a new filter for checking that the given field is greater than the given value.

Parameters
field: String

The field used for the filter.

value: Any?

The value used for the filter.

Returns
Filter

The newly created filter.

greaterThan

java-static fun greaterThan(fieldPath: FieldPath, value: Any?): Filter

Creates a new filter for checking that the given field is greater than the given value.

Parameters
fieldPath: FieldPath

The field path used for the filter.

value: Any?

The value used for the filter.

Returns
Filter

The newly created filter.

greaterThanOrEqualTo

java-static fun greaterThanOrEqualTo(field: String, value: Any?): Filter

Creates a new filter for checking that the given field is greater than or equal to the given value.

Parameters
field: String

The field used for the filter.

value: Any?

The value used for the filter.

Returns
Filter

The newly created filter.

greaterThanOrEqualTo

java-static fun greaterThanOrEqualTo(fieldPath: FieldPath, value: Any?): Filter

Creates a new filter for checking that the given field is greater than or equal to the given value.

Parameters
fieldPath: FieldPath

The field path used for the filter.

value: Any?

The value used for the filter.

Returns
Filter

The newly created filter.

inArray

java-static fun inArray(field: String, values: (Mutable)List<Any!>): Filter

Creates a new filter for checking that the given field equals any of the given values.

Parameters
field: String

The field used for the filter.

values: (Mutable)List<Any!>

The list of values used for the filter.

Returns
Filter

The newly created filter.

inArray

java-static fun inArray(fieldPath: FieldPath, values: (Mutable)List<Any!>): Filter

Creates a new filter for checking that the given field equals any of the given values.

Parameters
fieldPath: FieldPath

The field path used for the filter.

values: (Mutable)List<Any!>

The list of values used for the filter.

Returns
Filter

The newly created filter.

lessThan

java-static fun lessThan(field: String, value: Any?): Filter

Creates a new filter for checking that the given field is less than the given value.

Parameters
field: String

The field used for the filter.

value: Any?

The value used for the filter.

Returns
Filter

The newly created filter.

lessThan

java-static fun lessThan(fieldPath: FieldPath, value: Any?): Filter

Creates a new filter for checking that the given field is less than the given value.

Parameters
fieldPath: FieldPath

The field path used for the filter.

value: Any?

The value used for the filter.

Returns
Filter

The newly created filter.

lessThanOrEqualTo

java-static fun lessThanOrEqualTo(field: String, value: Any?): Filter

Creates a new filter for checking that the given field is less than or equal to the given value.

Parameters
field: String

The field used for the filter.

value: Any?

The value used for the filter.

Returns
Filter

The newly created filter.

lessThanOrEqualTo

java-static fun lessThanOrEqualTo(fieldPath: FieldPath, value: Any?): Filter

Creates a new filter for checking that the given field is less than or equal to the given value.

Parameters
fieldPath: FieldPath

The field path used for the filter.

value: Any?

The value used for the filter.

Returns
Filter

The newly created filter.

notEqualTo

java-static fun notEqualTo(field: String, value: Any?): Filter

Creates a new filter for checking that the given field is not equal to the given value.

Parameters
field: String

The field used for the filter.

value: Any?

The value used for the filter.

Returns
Filter

The newly created filter.

notEqualTo

java-static fun notEqualTo(fieldPath: FieldPath, value: Any?): Filter

Creates a new filter for checking that the given field is not equal to the given value.

Parameters
fieldPath: FieldPath

The field path used for the filter.

value: Any?

The value used for the filter.

Returns
Filter

The newly created filter.

notInArray

java-static fun notInArray(field: String, values: (Mutable)List<Any!>): Filter

Creates a new filter for checking that the given field does not equal any of the given values.

Parameters
field: String

The field path used for the filter.

values: (Mutable)List<Any!>

The list of values used for the filter.

Returns
Filter

The newly created filter.

notInArray

java-static fun notInArray(fieldPath: FieldPath, values: (Mutable)List<Any!>): Filter

Creates a new filter for checking that the given field does not equal any of the given values.

Parameters
fieldPath: FieldPath

The field path used for the filter.

values: (Mutable)List<Any!>

The list of values used for the filter.

Returns
Filter

The newly created filter.

or

java-static fun or(filters: Array<Filter!>!): Filter

Creates a new filter that is a disjunction of the given filters. A disjunction filter includes a document if it satisfiesany of the given filters.

Parameters
filters: Array<Filter!>!

The list of filters to perform a disjunction for.

Returns
Filter

The newly created filter.

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

Last updated 2025-07-21 UTC.