Polishing.

Reformat code. Tweak javadoc. Reject wildcard projection usage on properties with a MappingException. Omit wildcard projections when declared on document types that are used as subdocument.

See #3225
Original pull request: #3671.
This commit is contained in:
Mark Paluch
2021-07-14 15:03:39 +02:00
parent d57c5a9529
commit f3b90c2b8a
9 changed files with 87 additions and 23 deletions

View File

@@ -6,6 +6,7 @@
* Extended support for <<mapping-usage.document-references, referencing>> entities.
* Include/exclude `null` properties on write to `Document` through `@Field(write=…)`.
* Support for <<mapping-usage-indexes.wildcard-index>>.
[[new-features.3.2]]
== What's New in Spring Data MongoDB 3.2

View File

@@ -782,9 +782,9 @@ db.user.createIndex({ "userMetadata.$**" : 1 }, {})
----
====
The `@WildcardIndex` annotation allows a declarative index setup an can be added on either a type or property.
The `@WildcardIndex` annotation allows a declarative index setup that can used either with a document type or property.
If placed on a type that is a root level domain entity (one having an `@Document` annotation) will advise the index creator to create a
If placed on a type that is a root level domain entity (one annotated with `@Document`) , the index resolver will create a
wildcard index for it.
.Wildcard index on domain type
@@ -794,7 +794,7 @@ wildcard index for it.
@Document
@WildcardIndexed
public class Product {
...
// …
}
----
[source,javascript]
@@ -828,7 +828,8 @@ db.user.createIndex(
====
Wildcard indexes can also be expressed by adding the annotation directly to the field.
Please note that `wildcardProjection` is not allowed on nested paths.
Please note that `wildcardProjection` is not allowed on nested paths such as properties.
Projections on types annotated with `@WildcardIndexed` are omitted during index creation.
.Wildcard index on property
====