public final class Field extends Expression implements SelectableRepresents a reference to a field in a Firestore document.
Field references are used to access document field values in expressions and to specify fields for sorting, filtering, and projecting data in Firestore pipelines.
You can create a Field instance using the static #field(String) method:
// Create a Field instance for the 'name' field
Field nameField = Field.of("name");
// Create a Field instance for a nested field 'address.city'
Field cityField = Field.of("address.city");
Implements
SelectableStatic Fields
DOCUMENT_ID
public static final String DOCUMENT_ID| Field Value | |
|---|---|
| Type | Description |
String |
|
Static Methods
ofServerPath(String path)
public static Field ofServerPath(String path)| Parameter | |
|---|---|
| Name | Description |
path |
String |
| Returns | |
|---|---|
| Type | Description |
Field |
|
ofUserPath(String path)
public static Field ofUserPath(String path)Creates a Field instance representing the field at the given path.
The path can be a simple field name (e.g., "name") or a dot-separated path to a nested field (e.g., "address.city").
Example:
// Create a Field instance for the 'title' field
Field titleField = Field.of("title");
// Create a Field instance for a nested field 'author.firstName'
Field authorFirstNameField = Field.of("author.firstName");
| Parameter | |
|---|---|
| Name | Description |
path |
StringThe path to the field. |
| Returns | |
|---|---|
| Type | Description |
Field |
A new |
Methods
equals(Object o)
public boolean equals(Object o)| Parameter | |
|---|---|
| Name | Description |
o |
Object |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
getPath()
public FieldPath getPath()| Returns | |
|---|---|
| Type | Description |
FieldPath |
|
hashCode()
public int hashCode()| Returns | |
|---|---|
| Type | Description |
int |
|
toProto()
public Value toProto()| Returns | |
|---|---|
| Type | Description |
Value |
|