Skip to content

Commit eae32be

Browse files
committed
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.
1 parent 9d51ea4 commit eae32be

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,12 @@ public ProjectionOperationBuilder mod(String fieldReference) {
563563
return project("mod", Fields.field(fieldReference));
564564
}
565565

566+
/**
567+
* Generates a {@code $size} expression that returns the size of the array held by the given field. <br />
568+
*
569+
* @return never {@literal null}.
570+
* @since 1.7
571+
*/
566572
public ProjectionOperationBuilder size() {
567573
return project("size");
568574
}

src/main/asciidoc/reference/mapping.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ IMPORTANT: Automatic index creation is only done for types annotated with `@Docu
383383

384384
The MappingMongoConverter can use metadata to drive the mapping of objects to documents. An overview of the annotations is provided below
385385

386-
* `@Id` - applied at the field level to mark the field used for identiy purpose.
386+
* `@Id` - applied at the field level to mark the field used for identity purpose.
387387
* `@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.
388388
* `@DBRef` - applied at the field to indicate it is to be stored using a com.mongodb.DBRef.
389389
* `@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
397397
* `@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.
398398
* `@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.
399399

400-
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.
400+
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.
401401

402402
Here is an example of a more complex mapping.
403403

src/main/asciidoc/reference/mongodb.adoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1642,6 +1642,7 @@ The MongoDB Aggregation Framework provides the following types of Aggregation Op
16421642
* Arithmetic Aggregation Operators
16431643
* String Aggregation Operators
16441644
* Date Aggregation Operators
1645+
* Array Aggregation Operators
16451646
* Conditional Aggregation Operators
16461647
* Lookup Aggregation Operators
16471648

@@ -1661,6 +1662,10 @@ At the time of this writing we provide support for the following Aggregation Ope
16611662

16621663
| Comparison Aggregation Operators
16631664
| eq (*via: is), gt, gte, lt, lte, ne
1665+
1666+
| Array Aggregation Operators
1667+
| size, slice
1668+
16641669
|===
16651670

16661671
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> {
19941999
[[mongo.custom-converters.reader]]
19952000
=== Reading using a Spring Converter
19962001

1997-
An example implementation of a Converter that converts from a DBObject ot a Person object is shownn below
2002+
An example implementation of a Converter that converts from a DBObject ot a Person object is shown below
19982003

19992004
[source,java]
20002005
----

0 commit comments

Comments
 (0)