Skip to content

Commit 288e04b

Browse files
christophstroblmp911de
authored andcommitted
DATAMONGO-2509 - Update Reference Documentation.
Related to: DATAMONGO-365, DATAMONGO-384, DATAMONGO-2192, DATAMONGO-2407 Original pull request: #853.
1 parent 689c148 commit 288e04b

File tree

7 files changed

+124
-340
lines changed

7 files changed

+124
-340
lines changed

README.adoc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ public class MyService {
5252
@EnableMongoRepositories
5353
class ApplicationConfig extends AbstractMongoClientConfiguration {
5454
55-
@Override
56-
public MongoClient mongoClient() {
57-
return MongoClients.create();
58-
}
59-
6055
@Override
6156
protected String getDatabaseName() {
6257
return "springdata";

src/main/asciidoc/index.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ include::reference/mongo-auditing.adoc[leveloffset=+1]
3232
include::reference/mapping.adoc[leveloffset=+1]
3333
include::reference/sharding.adoc[leveloffset=+1]
3434
include::reference/kotlin.adoc[leveloffset=+1]
35-
include::reference/cross-store.adoc[leveloffset=+1]
3635
include::reference/jmx.adoc[leveloffset=+1]
3736
include::reference/mongo-3.adoc[leveloffset=+1]
3837

src/main/asciidoc/reference/cross-store.adoc

Lines changed: 0 additions & 260 deletions
This file was deleted.

src/main/asciidoc/reference/mapping.adoc

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -269,15 +269,8 @@ You can configure the `MappingMongoConverter` as well as `com.mongodb.client.Mon
269269
====
270270
[source,java]
271271
----
272-
import com.mongodb.client.MongoClients;
273-
274272
@Configuration
275-
public class GeoSpatialAppConfig extends AbstractMongoClientConfiguration {
276-
277-
@Bean
278-
public MongoClient mongoClient() {
279-
return MongoClients.create("monogodb://localhost:27017");
280-
}
273+
public class MongoConfig extends AbstractMongoClientConfiguration {
281274
282275
@Override
283276
public String getDatabaseName() {
@@ -287,12 +280,12 @@ public class GeoSpatialAppConfig extends AbstractMongoClientConfiguration {
287280
// the following are optional
288281
289282
@Override
290-
public String getMappingBasePackage() {
283+
public String getMappingBasePackage() { <1>
291284
return "com.bigbank.domain";
292285
}
293286
294287
@Override
295-
void configureConverters(MongoConverterConfigurationAdapter adapter) {
288+
void configureConverters(MongoConverterConfigurationAdapter adapter) { <2>
296289
297290
adapter.registerConverter(new org.springframework.data.mongodb.test.PersonReadConverter());
298291
adapter.registerConverter(new org.springframework.data.mongodb.test.PersonWriteConverter());
@@ -304,6 +297,8 @@ public class GeoSpatialAppConfig extends AbstractMongoClientConfiguration {
304297
}
305298
}
306299
----
300+
<1> The mapping base package defines the root path used to scan for entities used to pre initialize the `MappingContext`. By default the configuration classes package is used.
301+
<2> Configure additional custom converters for specific domain types that replace the default mapping procedure for those types with your custom implementation.
307302
====
308303

309304
`AbstractMongoClientConfiguration` requires you to implement methods that define a `com.mongodb.client.MongoClient` as well as provide a database name. `AbstractMongoClientConfiguration` also has a method named `getMappingBasePackage(…)` that you can override to tell the converter where to scan for classes annotated with the `@Document` annotation.
@@ -390,6 +385,8 @@ public class Person {
390385
IMPORTANT: The `@Id` annotation tells the mapper which property you want to use for the MongoDB `_id` property, and the `@Indexed` annotation tells the mapping framework to call `createIndex(…)` on that property of your document, making searches faster.
391386
Automatic index creation is only done for types annotated with `@Document`.
392387

388+
WARNING: Auto index creation is turned **OFF** by default and need to be enabled via the configuration (see <<mapping.index-creation>>).
389+
393390
[[mapping.index-creation]]
394391
=== Index Creation
395392

src/main/asciidoc/reference/mongo-custom-conversions.adoc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ class MyMongoConfiguration extends AbstractMongoClientConfiguration {
9494
return "database";
9595
}
9696
97-
@Override
98-
@Bean
99-
public MongoClient mongoClient() {
100-
return MongoClients.create();
101-
}
102-
10397
@Override
10498
protected void configureConverters(MongoConverterConfigurationAdapter adapter) {
10599
adapter.registerConverter(new com.example.PersonReadConverter());

src/main/asciidoc/reference/mongo-repositories.adoc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ class ApplicationConfig extends AbstractMongoClientConfiguration {
6464
return "e-store";
6565
}
6666
67-
@Override
68-
public MongoClient mongoClient() {
69-
return MongoClients.create();
70-
}
71-
7267
@Override
7368
protected String getMappingBasePackage() {
7469
return "com.oreilly.springdata.mongodb";

0 commit comments

Comments
 (0)