Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-hui committed Oct 4, 2024
1 parent 091ddf0 commit 14b67dd
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
34 changes: 34 additions & 0 deletions dev/src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,40 @@ export class Transaction implements firestore.Transaction {
);
}

/**
* @beta
*
* Executes this pipeline and returns a Promise to represent the asynchronous operation.
*
* <p>The returned Promise can be used to track the progress of the pipeline execution
* and retrieve the results (or handle any errors) asynchronously.
*
* <p>The pipeline results are returned as a list of {@link PipelineResult} objects. Each {@link
* PipelineResult} typically represents a single key/value map that has passed through all the
* stages of the pipeline, however this might differ depending on the stages involved in the
* pipeline. For example:
*
* <ul>
* <li>If there are no stages or only transformation stages, each {@link PipelineResult}
* represents a single document.</li>
* <li>If there is an aggregation, only a single {@link PipelineResult} is returned,
* representing the aggregated results over the entire dataset .</li>
* <li>If there is an aggregation stage with grouping, each {@link PipelineResult} represents a
* distinct group and its associated aggregated values.</li>
* </ul>
*
* <p>Example:
*
* ```typescript
* const futureResults = await transaction
* .execute(
* firestore.pipeline().collection("books")
* .where(gt(Field.of("rating"), 4.5))
* .select("title", "author", "rating"));
* ```
*
* @return A Promise representing the asynchronous pipeline execution.
*/
execute<AppModelType>(
pipeline: firestore.Pipeline<AppModelType>
): Promise<Array<PipelineResult<AppModelType>>> {
Expand Down
36 changes: 35 additions & 1 deletion types/firestore.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -808,8 +808,42 @@ declare namespace FirebaseFirestore {
>
): Promise<Array<DocumentSnapshot<AppModelType, DbModelType>>>;

/**
* @beta
*
* Executes this pipeline and returns a Promise to represent the asynchronous operation.
*
* <p>The returned Promise can be used to track the progress of the pipeline execution
* and retrieve the results (or handle any errors) asynchronously.
*
* <p>The pipeline results are returned as a list of {@link PipelineResult} objects. Each {@link
* PipelineResult} typically represents a single key/value map that has passed through all the
* stages of the pipeline, however this might differ depending on the stages involved in the
* pipeline. For example:
*
* <ul>
* <li>If there are no stages or only transformation stages, each {@link PipelineResult}
* represents a single document.</li>
* <li>If there is an aggregation, only a single {@link PipelineResult} is returned,
* representing the aggregated results over the entire dataset .</li>
* <li>If there is an aggregation stage with grouping, each {@link PipelineResult} represents a
* distinct group and its associated aggregated values.</li>
* </ul>
*
* <p>Example:
*
* ```typescript
* const futureResults = await transaction
* .execute(
* firestore.pipeline().collection("books")
* .where(gt(Field.of("rating"), 4.5))
* .select("title", "author", "rating"));
* ```
*
* @return A Promise representing the asynchronous pipeline execution.
*/
execute<AppModelType>(
pipeline: Pipeline<AppModelType>
pipeline: Pipeline<AppModelType>
): Promise<Array<PipelineResult<AppModelType>>>;

/**
Expand Down

0 comments on commit 14b67dd

Please sign in to comment.