@@ -1739,21 +1739,29 @@ Note that one can also define fields with aliases via the static factory method
1739
1739
====
1740
1740
[source,java]
1741
1741
----
1742
- project("name", "netPrice") // will generate {$project: {name: 1, netPrice: 1}}
1743
- project().and("foo").as("bar") // will generate {$project: {bar: $foo}}
1744
- project("a","b").and("foo").as("bar") // will generate {$project: {a: 1, b: 1, bar: $foo}}
1742
+ // will generate {$project: {name: 1, netPrice: 1}}
1743
+ project("name", "netPrice")
1744
+
1745
+ // will generate {$project: {bar: $foo}}
1746
+ project().and("foo").as("bar")
1747
+
1748
+ // will generate {$project: {a: 1, b: 1, bar: $foo}}
1749
+ project("a","b").and("foo").as("bar")
1745
1750
----
1746
1751
====
1747
1752
1748
1753
.Multi-Stage Aggregation using Projection and Sorting
1749
1754
====
1750
1755
[source,java]
1751
1756
----
1752
- project("name", "netPrice"), sort(ASC, "name") // will generate {$project: {name: 1, netPrice: 1}}, {$sort: {name: 1}}
1757
+ // will generate {$project: {name: 1, netPrice: 1}}, {$sort: {name: 1}}
1758
+ project("name", "netPrice"), sort(ASC, "name")
1753
1759
1754
- project().and("foo").as("bar"), sort(ASC, "bar") // will generate {$project: {bar: $foo}}, {$sort: {bar: 1}}
1760
+ // will generate {$project: {bar: $foo}}, {$sort: {bar: 1}}
1761
+ project().and("foo").as("bar"), sort(ASC, "bar")
1755
1762
1756
- project().and("foo").as("bar"), sort(ASC, "foo") // this will not work
1763
+ // this will not work
1764
+ project().and("foo").as("bar"), sort(ASC, "foo")
1757
1765
----
1758
1766
====
1759
1767
0 commit comments