FirebaseFirestore Framework Reference

Field

publicstructField:Expression,Selectable,BridgeWrapper,SelectableWrapper,@uncheckedSendable

AField is anExpression that represents a field in a Firestore document.

It is a central component for building queries and transformations in Firestore pipelines.AField can be used to:

  • Reference a document field by its name orFieldPath.
  • Create complexBooleanExpressions for filtering in awhere clause.
  • Perform mathematical operations on numeric fields.
  • Manipulate string and array fields.

Example of creating aField and using it in awhere clause:

// Reference the "price" field in a documentletpriceField=Field("price")// Create a query to find products where the price is greater than 100firestore.pipeline().collection("products").where(priceField.greaterThan(100))
  • The name of the field.

    Declaration

    Swift

    publicletfieldName:String
  • Creates a newField expression from a field name.

    Declaration

    Swift

    publicinit(_name:String)

    Parameters

    name

    The name of the field.

  • Creates a newField expression from aFieldPath.

    Declaration

    Swift

    publicinit(_path:FieldPath)

    Parameters

    path

    TheFieldPath of the field.

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.