Skip to content

Commit f81008b

Browse files
andrelmvchristophstrobl
authored andcommitted
Fix code snippets in index management examples.
Closes: #5039 Signed-off-by: André Monteiro <[email protected]>
1 parent 94845e0 commit f81008b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/antora/modules/ROOT/pages/mongodb/mapping/mapping-index-management.adoc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class MyListener{
5151
MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext = mongoTemplate
5252
.getConverter().getMappingContext();
5353
54+
IndexResolver resolver = new MongoPersistentEntityIndexResolver(mappingContext);
55+
5456
// consider only entities that are annotated with @Document
5557
mappingContext.getPersistentEntities()
5658
.stream()
@@ -123,8 +125,10 @@ public class Person {
123125
[source,java]
124126
----
125127
@Document
126-
@CompoundIndex(name = "cmp-idx-one", def = "{'firstname': 1, 'lastname': -1}")
127-
@CompoundIndex(name = "cmp-idx-two", def = "{'address.city': -1, 'address.street': 1}")
128+
@CompoundIndexes({
129+
@CompoundIndex(name = "cmp-idx-one", def = "{'firstname': 1, 'lastname': -1}"),
130+
@CompoundIndex(name = "cmp-idx-two", def = "{'address.city': -1, 'address.street': 1}")
131+
})
128132
public class Person {
129133
130134
String firstname;

0 commit comments

Comments
 (0)