Browse Source

DATAMONGO-1457 - Polishing.

Add missing Javadoc to size operator. Mention Array Aggregation Operators in reference docs. Fix typos in reference docs.

Original pull request: #372.
pull/374/head
Mark Paluch 10 years ago
parent
commit
eae32be568
  1. 6
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ProjectionOperation.java
  2. 4
      src/main/asciidoc/reference/mapping.adoc
  3. 7
      src/main/asciidoc/reference/mongodb.adoc

6
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ProjectionOperation.java

@ -563,6 +563,12 @@ public class ProjectionOperation implements FieldsExposingAggregationOperation { @@ -563,6 +563,12 @@ public class ProjectionOperation implements FieldsExposingAggregationOperation {
return project("mod", Fields.field(fieldReference));
}
/**
* Generates a {@code $size} expression that returns the size of the array held by the given field. <br />
*
* @return never {@literal null}.
* @since 1.7
*/
public ProjectionOperationBuilder size() {
return project("size");
}

4
src/main/asciidoc/reference/mapping.adoc

@ -383,7 +383,7 @@ IMPORTANT: Automatic index creation is only done for types annotated with `@Docu @@ -383,7 +383,7 @@ IMPORTANT: Automatic index creation is only done for types annotated with `@Docu
The MappingMongoConverter can use metadata to drive the mapping of objects to documents. An overview of the annotations is provided below
* `@Id` - applied at the field level to mark the field used for identiy purpose.
* `@Id` - applied at the field level to mark the field used for identity purpose.
* `@Document` - applied at the class level to indicate this class is a candidate for mapping to the database. You can specify the name of the collection where the database will be stored.
* `@DBRef` - applied at the field to indicate it is to be stored using a com.mongodb.DBRef.
* `@Indexed` - applied at the field level to describe how to index the field.
@ -397,7 +397,7 @@ The MappingMongoConverter can use metadata to drive the mapping of objects to do @@ -397,7 +397,7 @@ The MappingMongoConverter can use metadata to drive the mapping of objects to do
* `@Field` - applied at the field level and described the name of the field as it will be represented in the MongoDB BSON document thus allowing the name to be different than the fieldname of the class.
* `@Version` - applied at field level is used for optimistic locking and checked for modification on save operations. The initial value is `zero` which is bumped automatically on every update.
The mapping metadata infrastructure is defined in a seperate spring-data-commons project that is technology agnostic. Specific subclasses are using in the MongoDB support to support annotation based metadata. Other strategies are also possible to put in place if there is demand.
The mapping metadata infrastructure is defined in a separate spring-data-commons project that is technology agnostic. Specific subclasses are using in the MongoDB support to support annotation based metadata. Other strategies are also possible to put in place if there is demand.
Here is an example of a more complex mapping.

7
src/main/asciidoc/reference/mongodb.adoc

@ -1642,6 +1642,7 @@ The MongoDB Aggregation Framework provides the following types of Aggregation Op @@ -1642,6 +1642,7 @@ The MongoDB Aggregation Framework provides the following types of Aggregation Op
* Arithmetic Aggregation Operators
* String Aggregation Operators
* Date Aggregation Operators
* Array Aggregation Operators
* Conditional Aggregation Operators
* Lookup Aggregation Operators
@ -1661,6 +1662,10 @@ At the time of this writing we provide support for the following Aggregation Ope @@ -1661,6 +1662,10 @@ At the time of this writing we provide support for the following Aggregation Ope
| Comparison Aggregation Operators
| eq (*via: is), gt, gte, lt, lte, ne
| Array Aggregation Operators
| size, slice
|===
Note that the aggregation operations not listed here are currently not supported by Spring Data MongoDB. Comparison aggregation operators are expressed as `Criteria` expressions.
@ -1994,7 +1999,7 @@ public class PersonWriteConverter implements Converter<Person, DBObject> { @@ -1994,7 +1999,7 @@ public class PersonWriteConverter implements Converter<Person, DBObject> {
[[mongo.custom-converters.reader]]
=== Reading using a Spring Converter
An example implementation of a Converter that converts from a DBObject ot a Person object is shownn below
An example implementation of a Converter that converts from a DBObject ot a Person object is shown below
[source,java]
----

Loading…
Cancel
Save