From c1ac8767b779a06764433e4a7f53cff4b600695a Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Tue, 10 Jan 2017 08:20:49 +0100 Subject: [PATCH] DATAMONGO-1585 - Polishing. Update documentation for better readability in html and pdf format. Original Pull Request: #433 --- src/main/asciidoc/reference/mongodb.adoc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/asciidoc/reference/mongodb.adoc b/src/main/asciidoc/reference/mongodb.adoc index 792fdcbdf..d0a6c7b4e 100644 --- a/src/main/asciidoc/reference/mongodb.adoc +++ b/src/main/asciidoc/reference/mongodb.adoc @@ -1685,9 +1685,14 @@ Note that one can also define fields with aliases via the static factory method ==== [source,java] ---- -project("name", "netPrice") // will generate {$project: {name: 1, netPrice: 1}} -project().and("foo").as("bar") // will generate {$project: {bar: $foo}} -project("a","b").and("foo").as("bar") // will generate {$project: {a: 1, b: 1, bar: $foo}} +// will generate {$project: {name: 1, netPrice: 1}} +project("name", "netPrice") + +// will generate {$project: {bar: $foo}} +project().and("foo").as("bar") + +// will generate {$project: {a: 1, b: 1, bar: $foo}} +project("a","b").and("foo").as("bar") ---- ==== @@ -1695,11 +1700,14 @@ project("a","b").and("foo").as("bar") // will generate {$project: {a: 1, b: 1, b ==== [source,java] ---- -project("name", "netPrice"), sort(ASC, "name") // will generate {$project: {name: 1, netPrice: 1}}, {$sort: {name: 1}} +// will generate {$project: {name: 1, netPrice: 1}}, {$sort: {name: 1}} +project("name", "netPrice"), sort(ASC, "name") -project().and("foo").as("bar"), sort(ASC, "bar") // will generate {$project: {bar: $foo}}, {$sort: {bar: 1}} +// will generate {$project: {bar: $foo}}, {$sort: {bar: 1}} +project().and("foo").as("bar"), sort(ASC, "bar") -project().and("foo").as("bar"), sort(ASC, "foo") // this will not work +// this will not work +project().and("foo").as("bar"), sort(ASC, "foo") ---- ====