@@ -21,6 +21,7 @@ import com.google.common.collect.ImmutableList
2121import  com.google.firebase.Timestamp 
2222import  com.google.firebase.firestore.model.DocumentKey 
2323import  com.google.firebase.firestore.model.Values 
24+ import  com.google.firebase.firestore.pipeline.AbstractOptions 
2425import  com.google.firebase.firestore.pipeline.AddFieldsStage 
2526import  com.google.firebase.firestore.pipeline.AggregateFunction 
2627import  com.google.firebase.firestore.pipeline.AggregateStage 
@@ -38,9 +39,11 @@ import com.google.firebase.firestore.pipeline.FindNearestStage
3839import  com.google.firebase.firestore.pipeline.FunctionExpr 
3940import  com.google.firebase.firestore.pipeline.GenericArg 
4041import  com.google.firebase.firestore.pipeline.GenericStage 
42+ import  com.google.firebase.firestore.pipeline.InternalOptions 
4143import  com.google.firebase.firestore.pipeline.LimitStage 
4244import  com.google.firebase.firestore.pipeline.OffsetStage 
4345import  com.google.firebase.firestore.pipeline.Ordering 
46+ import  com.google.firebase.firestore.pipeline.PipelineOptions 
4447import  com.google.firebase.firestore.pipeline.RemoveFieldsStage 
4548import  com.google.firebase.firestore.pipeline.ReplaceStage 
4649import  com.google.firebase.firestore.pipeline.SampleStage 
@@ -72,17 +75,19 @@ internal constructor(
7275    return  Pipeline (firestore, userDataReader, stages.append(stage))
7376  }
7477
75-   fun  execute (): Task <PipelineSnapshot > {
78+   fun  execute (): Task <PipelineSnapshot > =  execute(PipelineOptions .DEFAULT )
79+ 
80+   fun  execute (options :  PipelineOptions ): Task <PipelineSnapshot > {
7681    val  observerTask =  ObserverSnapshotTask ()
77-     firestore.callClient { call ->  call!! .executePipeline(toProto(), observerTask) }
82+     firestore.callClient { call ->  call!! .executePipeline(toProto(options ), observerTask) }
7883    return  observerTask.task
7984  }
8085
8186  internal  fun  documentReference (key :  DocumentKey ): DocumentReference  {
8287    return  DocumentReference (key, firestore)
8388  }
8489
85-   private  fun  toProto (): ExecutePipelineRequest  {
90+   private  fun  toProto (options :   PipelineOptions ): ExecutePipelineRequest  {
8691    val  database =  firestore.databaseId
8792    val  builder =  ExecutePipelineRequest .newBuilder()
8893    builder.database =  " projects/${database.projectId} /databases/${database.databaseId} " 
@@ -169,7 +174,7 @@ internal constructor(
169174   */  
170175  fun  removeFields (field :  String , vararg  additionalFields :  String ): Pipeline  = 
171176    append(
172-       RemoveFieldsStage (arrayOf(Field .of (field), * additionalFields.map(Field ::of ).toTypedArray()))
177+       RemoveFieldsStage (arrayOf(Expr .field (field), * additionalFields.map(Expr ::field ).toTypedArray()))
173178    )
174179
175180  /* *
@@ -221,7 +226,7 @@ internal constructor(
221226    append(
222227      SelectStage (
223228        arrayOf(
224-           Field .of (fieldName),
229+           Expr .field (fieldName),
225230          * additionalSelections.map(Selectable ::toSelectable).toTypedArray()
226231        )
227232      )
@@ -253,10 +258,10 @@ internal constructor(
253258   * You can filter documents based on their field values, using implementations of [BooleanExpr], 
254259   * typically including but not limited to: 
255260   * 
256-    * - field comparators: [FunctionExpr .eq], [FunctionExpr .lt] (less than), [FunctionExpr .gt] 
261+    * - field comparators: [Expr .eq], [Expr .lt] (less than), [Expr .gt] 
257262   * (greater than), etc. 
258-    * - logical operators: [FunctionExpr .and], [FunctionExpr .or], [FunctionExpr .not], etc. 
259-    * - advanced functions: [FunctionExpr .regexMatch], [FunctionExpr .arrayContains[ ], etc. 
263+    * - logical operators: [Expr .and], [Expr .or], [Expr .not], etc. 
264+    * - advanced functions: [Expr .regexMatch], [Expr .arrayContains], etc. 
260265   * 
261266   * @param condition The [BooleanExpr] to apply. 
262267   * @return A new [Pipeline] object with this stage appended to the stage list. 
@@ -336,7 +341,7 @@ internal constructor(
336341    append(
337342      DistinctStage (
338343        arrayOf(
339-           Field .of (groupField),
344+           Expr .field (groupField),
340345          * additionalGroups.map(Selectable ::toSelectable).toTypedArray()
341346        )
342347      )
@@ -468,7 +473,7 @@ internal constructor(
468473   * @param field The [String] specifying the field name containing the nested map. 
469474   * @return A new [Pipeline] object with this stage appended to the stage list. 
470475   */  
471-   fun  replace (field :  String ): Pipeline  =  replace(Field .of (field))
476+   fun  replace (field :  String ): Pipeline  =  replace(Expr .field (field))
472477
473478  /* *
474479   * Fully overwrites all fields in a document with those coming from a nested map. 
@@ -530,7 +535,7 @@ internal constructor(
530535   * @return A new [Pipeline] object with this stage appended to the stage list. 
531536   */  
532537  fun  unnest (arrayField :  String , alias :  String ): Pipeline  = 
533-     unnest(Field .of (arrayField).alias(alias))
538+     unnest(Expr .field (arrayField).alias(alias))
534539
535540  /* *
536541   * Takes a specified array from the input documents and outputs a document for each element with 
0 commit comments