@@ -254,7 +254,7 @@ func (p *Pipeline) Execute(ctx context.Context, opts ...ExecuteOption) *Pipeline
254254 }
255255
256256 if newP .c == nil {
257- newP .err = fmt .Errorf ("This pipeline was created without a database (e.g., as a subcollection pipeline) and cannot be executed directly. It can only be used as part of another pipeline. " )
257+ newP .err = fmt .Errorf ("pipeline created without a database (e.g., as a subcollection pipeline) cannot be executed directly; it can only be used as part of another pipeline" )
258258 return & PipelineSnapshot {
259259 iter : & PipelineResultIterator {
260260 err : newP .err ,
@@ -898,7 +898,7 @@ func (p *Pipeline) Union(other *Pipeline, opts ...UnionOption) *Pipeline {
898898 return p
899899 }
900900 if other .c == nil {
901- p .err = fmt .Errorf ("Union only supports combining root pipelines, doesn't support relative scope Pipeline like relative subcollection pipeline " )
901+ p .err = fmt .Errorf ("union only supports combining root pipelines; relative scope pipelines ( like subcollection pipelines) are not supported " )
902902 return p
903903 }
904904 options := make (map [string ]any )
@@ -1267,7 +1267,7 @@ func (p *Pipeline) Delete(opts ...DeleteOption) *Pipeline {
12671267 return p .append (stage )
12681268}
12691269
1270- // Scalar converts this Pipeline into an expression that evaluates to a single scalar result.
1270+ // ToScalarExpression converts this Pipeline into an expression that evaluates to a single scalar result.
12711271// Used for 1:1 lookups or Aggregations when the subquery is expected to return a single value or object.
12721272//
12731273// Example:
@@ -1277,7 +1277,7 @@ func (p *Pipeline) Delete(opts ...DeleteOption) *Pipeline {
12771277// AddFields(Selectables(
12781278// Subcollection("reviews").
12791279// Aggregate(Accumulators(Average("rating").As("avg_score"))).
1280- // Scalar ().As("stats"),
1280+ // ToScalarExpression ().As("stats"),
12811281// ))
12821282// // Output format:
12831283// // [
@@ -1333,13 +1333,15 @@ type DefineOption interface {
13331333 isDefineOption ()
13341334}
13351335
1336- // Define adds a "let" stage to the pipeline to define variables.
1336+ // Define defines one or more variables in the pipeline's scope. `Define` is used to bind a value to a
1337+ // variable for internal reuse within the pipeline body (accessed via the [Variable] function).
13371338//
1338- // Defines one or more variables in the pipeline's scope. `Define` is used to bind a value to a
1339- // name, which can be referenced in subsequent stages using [Variable].
1339+ // This stage is useful for declaring reusable values or intermediate calculations that can be
1340+ // referenced multiple times in later parts of the pipeline, improving readability and
1341+ // maintainability.
13401342//
13411343// Each variable is defined using an [AliasedExpression], which pairs an expression with
1342- // its alias (the variable name ).
1344+ // a name (alias ).
13431345//
13441346// Example:
13451347//
0 commit comments