Field
public struct Field: Expression, Selectable, BridgeWrapper, SelectableWrapper,
@unchecked SendableA Field is an Expression that represents a field in a Firestore document.
It is a central component for building queries and transformations in Firestore pipelines.
A Field can be used to:
- Reference a document field by its name or
FieldPath. - Create complex
BooleanExpressions for filtering in awhereclause. - Perform mathematical operations on numeric fields.
- Manipulate string and array fields.
Example of creating a Field and using it in a where clause:
// Reference the "price" field in a document
let priceField = Field("price")
// Create a query to find products where the price is greater than 100
firestore.pipeline()
.collection("products")
.where(priceField.greaterThan(100))
-
The name of the field.
Declaration
Swift
public let fieldName: String -
Creates a new
Fieldexpression from a field name.Declaration
Swift
public init(_ name: String)Parameters
nameThe name of the field.