docs-devsite/firestore_lite_pipelines.pipelineresult.md
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 %}
A PipelineResult contains data read from a Firestore Pipeline. The data can be extracted with the PipelineResult.data() or PipelineResult.get() methods.
<p>If the PipelineResult represents a non-document result, `ref` will return a undefined value.<b>Signature:</b>
export declare class PipelineResult<AppModelType = DocumentData>
| Property | Modifiers | Type | Description |
|---|---|---|---|
| createTime | Timestamp | undefined | The time the document was created. Undefined if this result is not a document. | |
| id | string | undefined | The ID of the document for which this PipelineResult contains data, if it is a document; otherwise <code>undefined</code>. | |
| ref | DocumentReference | undefined | The reference of the document, if it is a document; otherwise <code>undefined</code>. | |
| updateTime | Timestamp | undefined | The time the document was last updated (at the time the snapshot was generated). Undefined if this result is not a document. |
| Method | Modifiers | Description |
|---|---|---|
| data() | Retrieves all fields in the result as an object. | |
| get(fieldPath) | Retrieves the field specified by <code>field</code>. |
The time the document was created. Undefined if this result is not a document.
<b>Signature:</b>
get createTime(): Timestamp | undefined;
The ID of the document for which this PipelineResult contains data, if it is a document; otherwise undefined<!-- -->.
<b>Signature:</b>
get id(): string | undefined;
The reference of the document, if it is a document; otherwise undefined<!-- -->.
<b>Signature:</b>
get ref(): DocumentReference | undefined;
The time the document was last updated (at the time the snapshot was generated). Undefined if this result is not a document.
<b>Signature:</b>
get updateTime(): Timestamp | undefined;
Retrieves all fields in the result as an object.
<b>Signature:</b>
data(): AppModelType;
<b>Returns:</b>
AppModelType
An object containing all fields in the document or 'undefined' if the document doesn't exist.
let p = firestore.pipeline().collection('col');
p.execute().then(results => {
let data = results[0].data();
console.log(`Retrieved data: ${JSON.stringify(data)}`);
});
Retrieves the field specified by field<!-- -->.
<b>Signature:</b>
get(fieldPath: string | FieldPath | Field): any;
| Parameter | Type | Description |
|---|---|---|
| fieldPath | string | FieldPath | Field |
<b>Returns:</b>
any
The data at the specified field location or undefined if no such field exists.
let p = firestore.pipeline().collection('col');
p.execute().then(results => {
let field = results[0].get('a.b');
console.log(`Retrieved field value: ${field}`);
});