Browse Source

DATAMONGO-774 - Some polishing in the reference documentation.

pull/85/head
Oliver Gierke 12 years ago
parent
commit
6e5f3661a8
  1. 54
      src/docbkx/reference/mongodb.xml

54
src/docbkx/reference/mongodb.xml

@ -1550,8 +1550,9 @@ List<Person> result = mongoTemplate.find(query(where("age").lt(50)
and <literal>Query.query</literal> to make the query more and <literal>Query.query</literal> to make the query more
readable.</para> readable.</para>
<para>This query should return a list of Person objects that meet the <para>This query should return a list of <classname>Person</classname>
specified criteria. The Criteria class has the following methods that objects that meet the specified criteria. The
<classname>Criteria</classname> class has the following methods that
correspond to the operators provided in MongoDB.</para> correspond to the operators provided in MongoDB.</para>
<para>As you can see most methods return the <para>As you can see most methods return the
@ -2414,23 +2415,17 @@ project("a","b").and("foo").as("bar") // will generate {$project: {a: 1, b: 1, b
be found in the <ulink be found in the <ulink
url="http://docs.mongodb.org/manual/reference/operator/aggregation/project/#pipe._S_project">corresponding url="http://docs.mongodb.org/manual/reference/operator/aggregation/project/#pipe._S_project">corresponding
section</ulink> of the MongoDB Aggregation Framework reference section</ulink> of the MongoDB Aggregation Framework reference
documentation. </para> documentation.</para>
<section id="mongo.aggregation.projection.expressions"> <section id="mongo.aggregation.projection.expressions">
<title>Spring Expresison Support in Projection Expressions</title> <title>Spring Expresison Support in Projection Expressions</title>
<para>Since Version 1.4.0 we support the use of SpEL expression in <para>As of Version 1.4.0 we support the use of SpEL expression in
Projection expressions via the <methodname>andExpression</methodname> projection expressions via the <methodname>andExpression</methodname>
method of the <classname>ProjectionOperation</classname> class. This method of the <classname>ProjectionOperation</classname> class. This
allows a developer to define the desired expression as a SpEL allows you to define the desired expression as a SpEL expression which
expression string which is then translated to a corresponding MongoDB is translated into a corresponding MongoDB projection expression part
projection expression part on query execution.</para> on query execution. This makes it much easier to express complex
<para>Note that one can find more usage examples for supported SpEL
expression constructs in
<classname>SpelExpressionToMongoExpressionTransformerUnitTests</classname>.</para>
<para>This makes it much easier to express complex
calculations.</para> calculations.</para>
<example> <example>
@ -2443,28 +2438,19 @@ project("a","b").and("foo").as("bar") // will generate {$project: {a: 1, b: 1, b
<para>will be translated into the following projection expression <para>will be translated into the following projection expression
part:</para> part:</para>
<programlisting language="javascript">{ <programlisting language="javascript">{ "$add" : [ 1, {
"$add":[ "$divide" : [ {
1, "$add":["$q", 1]}, {
{ "$subtract":[ "$q", 1]}
"$divide":[
{
"$add":[
"$q",
1
]
},
{
"$subtract":[
"$q",
1
]
}
] ]
} }]}</programlisting>
]
}</programlisting>
</example> </example>
<para>Have a look at an example in more context in <xref
linkend="mongo.aggregation.examples.example5"/> and <xref
linkend="mongo.aggregation.examples.example6"/>. You can find more
usage examples for supported SpEL expression constructs in
<classname>SpelExpressionTransformerUnitTests</classname>.</para>
</section> </section>
</section> </section>

Loading…
Cancel
Save