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