FirebaseFirestore Framework Reference Stay organized with collections Save and categorize content based on your preferences.
Functions
The following functions are available globally.
Combines two boolean expressions with a logical AND (
&&).The resulting expression is
trueonly if both the left-hand side (lhs) and the right-handside (rhs) aretrue.// Find books in the "Fantasy" genre with a rating greater than 4.5firestore.pipeline().collection("books").where(Field("genre").equal("Fantasy")&&Field("rating").greaterThan(4.5))Declaration
Swift
publicfunc&&(lhs:BooleanExpression,rhs:@autoclosure()throws->BooleanExpression)rethrows->BooleanExpressionParameters
lhsThe left-hand boolean expression.
rhsThe right-hand boolean expression.
Return Value
A new
BooleanExpressionrepresenting the logical AND.Combines two boolean expressions with a logical OR (
||).The resulting expression is
trueif either the left-hand side (lhs) or the right-handside (rhs) istrue.// Find books that are either in the "Romance" genre or were published before 1900firestore.pipeline().collection("books").where(Field("genre").equal("Romance")||Field("published").lessThan(1900))Declaration
Swift
publicfunc||(lhs:BooleanExpression,rhs:@autoclosure()throws->BooleanExpression)rethrows->BooleanExpressionParameters
lhsThe left-hand boolean expression.
rhsThe right-hand boolean expression.
Return Value
A new
BooleanExpressionrepresenting the logical OR.Combines two boolean expressions with a logical XOR (
^).The resulting expression is
trueif the left-hand side (lhs) and the right-hand side(rhs) have different boolean values.// Find books that are in the "Dystopian" genre OR have a rating of 5.0, but not both.firestore.pipeline().collection("books").where(Field("genre").equal("Dystopian")^Field("rating").equal(5.0))Declaration
Swift
publicfunc^(lhs:BooleanExpression,rhs:@autoclosure()throws->BooleanExpression)rethrows->BooleanExpressionParameters
lhsThe left-hand boolean expression.
rhsThe right-hand boolean expression.
Return Value
A new
BooleanExpressionrepresenting the logical XOR.Negates a boolean expression with a logical NOT (
!).The resulting expression is
trueif the original expression isfalse, and vice versa.// Find books that are NOT in the "Science Fiction" genrefirestore.pipeline().collection("books").where(!Field("genre").equal("Science Fiction"))Declaration
Swift
publicprefixfunc!(lhs:BooleanExpression)->BooleanExpressionParameters
lhsThe boolean expression to negate.
Return Value
A new
BooleanExpressionrepresenting the logical NOT.
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 2026-01-13 UTC.