* feat(firestore): Added search stage support for languageCode, offset, limit, and retrievalDepth * Create four-bottles-marry.md * docgen * PR feedback * Update packages/firestore/src/lite-api/stage_options.ts Co-authored-by: Daniel La Rocque <[email protected]> * Improve ref doc * More search refDoc improvements * Consistent capitalization of search within ref docs * remove deleted rut file * docs devsite --------- Co-authored-by: Daniel La Rocque <[email protected]>
3.2 KiB
Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference
{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}
Field class
Represents a reference to a field in a Firestore document, or outputs of a Pipeline stage.
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 method:
Signature:
export declare class Field extends Expression implements Selectable
Extends: Expression
Implements: Selectable
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| alias | string | ||
| expr | Expression | ||
| expressionType | ExpressionType | ||
| fieldName | string | ||
| selectable | true |
Methods
| Method | Modifiers | Description |
|---|---|---|
| geoDistance(location) | (Public Preview) Evaluates to the distance in meters between the location specified by this field and the query location. |
Field.alias
Signature:
get alias(): string;
Field.expr
Signature:
get expr(): Expression;
Field.expressionType
Signature:
readonly expressionType: ExpressionType;
Field.fieldName
Signature:
get fieldName(): string;
Field.selectable
Signature:
selectable: true;
Field.geoDistance()
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Evaluates to the distance in meters between the location specified by this field and the query location.
This Expression can only be used within a search stage.
Signature:
geoDistance(location: GeoPoint | Expression): Expression;
Parameters
| Parameter | Type | Description |
|---|---|---|
| location | GeoPoint | Expression | Compute distance to this GeoPoint. |
Returns:
Example
// Create a Field instance for the 'name' field
const nameField = field("name");
// Create a Field instance for a nested field 'address.city'
const cityField = field("address.city");