@@ -466,83 +466,96 @@ public protocol Expression: Sendable {
466466 ///
467467 /// - Parameter other: The expression to compare against.
468468 /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
469+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
470+ /// boolean expressions.
469471 func greaterThan( _ other: Expression ) -> BooleanExpression
470472
471473 /// Creates a `BooleanExpression` that returns `true` if this expression is greater
472474 /// than the given value.
473475 ///
474476 /// - Parameter other: The value to compare against.
475- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
477+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
478+ /// boolean expressions.
476479 func greaterThan( _ other: Sendable ) -> BooleanExpression
477480
478481 /// Creates a `BooleanExpression` that returns `true` if this expression is
479482 /// greater than or equal to the given expression.
480483 ///
481484 /// - Parameter other: The expression to compare against.
482- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
485+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
486+ /// boolean expressions.
483487 func greaterThanOrEqual( _ other: Expression ) -> BooleanExpression
484488
485489 /// Creates a `BooleanExpression` that returns `true` if this expression is
486490 /// greater than or equal to the given value.
487491 ///
488492 /// - Parameter other: The value to compare against.
489- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
493+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
494+ /// boolean expressions.
490495 func greaterThanOrEqual( _ other: Sendable ) -> BooleanExpression
491496
492497 /// Creates a `BooleanExpression` that returns `true` if this expression is less
493498 /// than the given expression.
494499 ///
495500 /// - Parameter other: The expression to compare against.
496- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
501+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
502+ /// boolean expressions.
497503 func lessThan( _ other: Expression ) -> BooleanExpression
498504
499505 /// Creates a `BooleanExpression` that returns `true` if this expression is less
500506 /// than the given value.
501507 ///
502508 /// - Parameter other: The value to compare against.
503- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
509+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
510+ /// boolean expressions.
504511 func lessThan( _ other: Sendable ) -> BooleanExpression
505512
506513 /// Creates a `BooleanExpression` that returns `true` if this expression is less
507514 /// than or equal to the given expression.
508515 ///
509516 /// - Parameter other: The expression to compare against.
510- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
517+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
518+ /// boolean expressions.
511519 func lessThanOrEqual( _ other: Expression ) -> BooleanExpression
512520
513521 /// Creates a `BooleanExpression` that returns `true` if this expression is less
514522 /// than or equal to the given value.
515523 ///
516524 /// - Parameter other: The value to compare against.
517- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
525+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
526+ /// boolean expressions.
518527 func lessThanOrEqual( _ other: Sendable ) -> BooleanExpression
519528
520529 /// Creates a `BooleanExpression` that returns `true` if this expression is equal
521530 /// to the given expression.
522531 ///
523532 /// - Parameter other: The expression to compare against.
524- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
533+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
534+ /// boolean expressions.
525535 func equal( _ other: Expression ) -> BooleanExpression
526536
527537 /// Creates a `BooleanExpression` that returns `true` if this expression is equal
528538 /// to the given value.
529539 ///
530540 /// - Parameter other: The value to compare against.
531- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
541+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
542+ /// boolean expressions.
532543 func equal( _ other: Sendable ) -> BooleanExpression
533544
534545 /// Creates a `BooleanExpression` that returns `true` if this expression is not
535546 /// equal to the given expression.
536547 ///
537548 /// - Parameter other: The expression to compare against.
538- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
549+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
550+ /// boolean expressions.
539551 func notEqual( _ other: Expression ) -> BooleanExpression
540552
541553 /// Creates a `BooleanExpression` that returns `true` if this expression is not
542554 /// equal to the given value.
543555 ///
544556 /// - Parameter other: The value to compare against.
545- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
557+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
558+ /// boolean expressions.
546559 func notEqual( _ other: Sendable ) -> BooleanExpression
547560
548561 /// Creates an expression that checks if this expression is equal to any of the provided
@@ -554,7 +567,8 @@ public protocol Expression: Sendable {
554567 /// ```
555568 ///
556569 /// - Parameter others: An array of at least one `Expression` value to check against.
557- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
570+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
571+ /// boolean expressions.
558572 func equalAny( _ others: [ Expression ] ) -> BooleanExpression
559573
560574 /// Creates an expression that checks if this expression is equal to any of the provided literal
@@ -566,7 +580,8 @@ public protocol Expression: Sendable {
566580 /// ```
567581 ///
568582 /// - Parameter others: An array of at least one `Sendable` literal value to check against.
569- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
583+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
584+ /// boolean expressions.
570585 func equalAny( _ others: [ Sendable ] ) -> BooleanExpression
571586
572587 /// Creates an expression that checks if this expression is equal to any of the provided
@@ -578,7 +593,8 @@ public protocol Expression: Sendable {
578593 /// ```
579594 ///
580595 /// - Parameter arrayExpression: An `Expression` elements evaluated to be array.
581- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
596+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
597+ /// boolean expressions.
582598 func equalAny( _ arrayExpression: Expression ) -> BooleanExpression
583599
584600 /// Creates an expression that checks if this expression is not equal to any of the provided
@@ -590,7 +606,8 @@ public protocol Expression: Sendable {
590606 /// ```
591607 ///
592608 /// - Parameter others: An array of at least one `Expression` value to check against.
593- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
609+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
610+ /// boolean expressions.
594611 func notEqualAny( _ others: [ Expression ] ) -> BooleanExpression
595612
596613 /// Creates an expression that checks if this expression is not equal to any of the provided
@@ -602,7 +619,8 @@ public protocol Expression: Sendable {
602619 /// ```
603620 ///
604621 /// - Parameter others: An array of at least one `Sendable` literal value to check against.
605- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
622+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
623+ /// boolean expressions.
606624 func notEqualAny( _ others: [ Sendable ] ) -> BooleanExpression
607625
608626 /// Creates an expression that checks if this expression is equal to any of the provided
@@ -614,7 +632,8 @@ public protocol Expression: Sendable {
614632 /// ```
615633 ///
616634 /// - Parameter arrayExpression: An `Expression` elements evaluated to be array.
617- /// - Returns: A `BooleanExpression` that can be used in `where` clauses.
635+ /// - Returns: A `BooleanExpression` that can be used in a where stage, together with other
636+ /// boolean expressions.
618637 func notEqualAny( _ arrayExpression: Expression ) -> BooleanExpression
619638
620639 /// Creates an expression that checks if a field exists in the document.
@@ -721,7 +740,7 @@ public protocol Expression: Sendable {
721740 /// ```
722741 ///
723742 /// - Parameter pattern: The literal string regular expression to use for the search.
724- /// - Returns: A new `BooleanExpression ` representing the "regex_contains" comparison.
743+ /// - Returns: A new `BooleanExpr ` representing the "regex_contains" comparison.
725744 func regexContains( _ pattern: String ) -> BooleanExpression
726745
727746 /// Creates an expression that checks if a string (from `self`) contains a specified regular
@@ -868,17 +887,32 @@ public protocol Expression: Sendable {
868887 /// - Returns: A new `FunctionExpression` representing the uppercase string.
869888 func toUpper( ) -> FunctionExpression
870889
871- /// Creates an expression that removes leading and trailing whitespace from a string (from
872- /// `self`).
873- /// Assumes `self` evaluates to a string.
890+ /// Creates an expression that removes leading and trailing occurrences of specified characters
891+ /// from a string (from `self`).
892+ /// Assumes `self` evaluates to a string, and `value` evaluates to a string.
893+ ///
894+ /// ```swift
895+ /// // Trim leading/trailing "xy" from field
896+ /// Field("code").trim(characters: "xy")
897+ /// ```
898+ ///
899+ /// - Parameter value: A `String` containing the characters to trim.
900+ /// - Returns: A new `FunctionExpression` representing the trimmed string.
901+ func trim( _ value: String ) -> FunctionExpression
902+
903+ /// Creates an expression that removes leading and trailing occurrences of specified string
904+ /// (from an expression) from a string (from `self`).
905+ /// Assumes `self` evaluates to a string, and `value` evaluates to a string.
874906 ///
875907 /// ```swift
876- /// // Trim whitespace from the "userInput " field
877- /// Field("userInput ").trim()
908+ /// // Trim characters specified by the "trimChars " field from "data"
909+ /// Field("data ").trim(characters: Field("trimChars") )
878910 /// ```
879911 ///
912+ /// - Parameter value: An `Expression` (evaluating to a string) containing the characters to
913+ /// trim.
880914 /// - Returns: A new `FunctionExpression` representing the trimmed string.
881- func trim( ) -> FunctionExpression
915+ func trim( _ value : Expression ) -> FunctionExpression
882916
883917 /// Creates an expression that concatenates this string expression with other string expressions.
884918 /// Assumes `self` and all parameters evaluate to strings.
0 commit comments