You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/mongodb/aggregation-framework.adoc
+1-1
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ For further information, see the full https://docs.mongodb.org/manual/aggregatio
8
8
[[mongo.aggregation.basic-concepts]]
9
9
== Basic Concepts
10
10
11
-
The Aggregation Framework support in Spring Data MongoDB is based on the following key abstractions: `Aggregation`, `AggregationDefinition`, and `AggregationResults`.
11
+
The Aggregation Framework support in Spring Data MongoDB is based on the following key abstractions: javadoc:org.springframework.data.mongodb.core.aggregation.Aggregation[] and javadoc:org.springframework.data.mongodb.core.aggregation.AggregationResults[].
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/mongodb/change-streams.adoc
+3-3
Original file line number
Diff line number
Diff line change
@@ -16,8 +16,8 @@ In doubt, use `Document`.
16
16
== Change Streams with `MessageListener`
17
17
18
18
Listening to a https://docs.mongodb.com/manual/tutorial/change-streams-example/[Change Stream by using a Sync Driver] creates a long running, blocking task that needs to be delegated to a separate component.
19
-
In this case, we need to first create a `MessageListenerContainer`, which will be the main entry point for running the specific `SubscriptionRequest` tasks.
20
-
Spring Data MongoDB already ships with a default implementation that operates on `MongoTemplate` and is capable of creating and running `Task` instances for a `ChangeStreamRequest`.
19
+
In this case, we need to first create a javadoc:org.springframework.data.mongodb.core.messaging.MessageListenerContainer[] which will be the main entry point for running the specific `SubscriptionRequest` tasks.
20
+
Spring Data MongoDB already ships with a default implementation that operates on `MongoTemplate` and is capable of creating and running `Task` instances for a javadoc:org.springframework.data.mongodb.core.messaging.ChangeStreamRequest[].
21
21
22
22
The following example shows how to use Change Streams with `MessageListener` instances:
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/mongodb/getting-started.adoc
+1-1
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ Person [id=4ddbba3c0be56b7e1b210166, name=Joe, age=34]
55
55
Even in this simple example, there are few things to notice:
56
56
57
57
* You can instantiate the central helper class of Spring Mongo, xref:mongodb/template-api.adoc[`MongoTemplate`], by using the standard or reactive `MongoClient` object and the name of the database to use.
58
-
* The mapper works against standard POJO objects without the need for any additional metadata (though you can optionally provide that information. See xref:mongodb/mapping/mapping.adoc[here].).
58
+
* The mapper works against standard POJO objects without the need for any additional metadata (though you can optionally provide that information. See xref:mongodb/mapping/mapping.adoc[here]).
59
59
* Conventions are used for handling the `id` field, converting it to be an `ObjectId` when stored in the database.
60
60
* Mapping conventions can use field access. Notice that the `Person` class has only getters.
61
61
* If the constructor argument names match the field names of the stored document, they are used to instantiate the object
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/mongodb/lifecycle-events.adoc
+2-2
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ The MongoDB mapping framework includes several `org.springframework.context.Appl
5
5
Being based on Spring's `ApplicationContext` event infrastructure enables other products, such as Spring Integration, to easily receive these events, as they are a well known eventing mechanism in Spring-based applications.
6
6
7
7
Entity lifecycle events can be costly and you may notice a change in the performance profile when loading large result sets.
8
-
You can disable lifecycle events on the link:https://docs.spring.io/spring-data/mongodb/docs/{version}/api/org/springframework/data/mongodb/core/MongoTemplate.html#setEntityLifecycleEventsEnabled(boolean)[Template API].
8
+
You can disable lifecycle events on the javadoc:org.springframework.data.mongodb.core.MongoTemplate#setEntityLifecycleEventsEnabled(boolean)[Template API].
9
9
10
10
To intercept an object before it goes through the conversion process (which turns your domain object into a `org.bson.Document`), you can register a subclass of `AbstractMongoEventListener` that overrides the `onBeforeConvert` method.
11
11
When the event is dispatched, your listener is called and passed the domain object before it goes into the converter.
@@ -23,7 +23,7 @@ public class BeforeConvertListener extends AbstractMongoEventListener<Person> {
23
23
----
24
24
====
25
25
26
-
To intercept an object before it goes into the database, you can register a subclass of `org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener` that overrides the `onBeforeSave` method. When the event is dispatched, your listener is called and passed the domain object and the converted `com.mongodb.Document`. The following example shows how to do so:
26
+
To intercept an object before it goes into the database, you can register a subclass of javadoc:org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener[] that overrides the `onBeforeSave` method. When the event is dispatched, your listener is called and passed the domain object and the converted `com.mongodb.Document`. The following example shows how to do so:
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/mongodb/template-api.adoc
+7-7
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,22 @@
1
1
[[mongo-template]]
2
2
= Template API
3
3
4
-
The `MongoTemplate` and its reactive counterpart class, located in the `org.springframework.data.mongodb.core` package, is the central class of Spring's MongoDB support and provides a rich feature set for interacting with the database.
4
+
The javadoc:org.springframework.data.mongodb.core.MongoTemplate[] and its javadoc:org.springframework.data.mongodb.core.ReactiveMongoTemplate[reactive] counterpart class, located in the `org.springframework.data.mongodb.core` package, is the central class of Spring's MongoDB support and provides a rich feature set for interacting with the database.
5
5
The template offers convenience operations to create, update, delete, and query MongoDB documents and provides a mapping between your domain objects and MongoDB documents.
6
6
7
7
NOTE: Once configured, `MongoTemplate` is thread-safe and can be reused across multiple instances.
8
8
9
9
[[mongo-template.convenience-methods]]
10
10
== Convenience Methods
11
11
12
-
The `MongoTemplate` class implements the interface `MongoOperations`.
12
+
The javadoc:org.springframework.data.mongodb.core.MongoTemplate[] class implements the interface javadoc:org.springframework.data.mongodb.core.MongoOperations[].
13
13
In as much as possible, the methods on `MongoOperations` are named after methods available on the MongoDB driver `Collection` object, to make the API familiar to existing MongoDB developers who are used to the driver API.
14
14
For example, you can find methods such as `find`, `findAndModify`, `findAndReplace`, `findOne`, `insert`, `remove`, `save`, `update`, and `updateMulti`.
15
15
The design goal was to make it as easy as possible to transition between the use of the base MongoDB driver and `MongoOperations`.
16
16
A major difference between the two APIs is that `MongoOperations` can be passed domain objects instead of `Document`.
17
17
Also, `MongoOperations` has fluent APIs for `Query`, `Criteria`, and `Update` operations instead of populating a `Document` to specify the parameters for those operations.
18
18
19
-
For more information please refer to the the xref:mongodb/template-crud-operations.adoc[CRUD] and xref:mongodb/template-query-operations.adoc[Query] sections of the documentation.
19
+
For more information please refer to the xref:mongodb/template-crud-operations.adoc[CRUD] and xref:mongodb/template-query-operations.adoc[Query] sections of the documentation.
20
20
21
21
NOTE: The preferred way to reference the operations on `MongoTemplate` instance is through its interface, `MongoOperations`.
22
22
@@ -37,7 +37,7 @@ The `execute` callbacks gives you a reference to either a `MongoCollection` or a
37
37
38
38
* `<T> T` *executeInSession* `(DbCallback<T> action)`: Runs the given `DbCallback` within the same connection to the database so as to ensure consistency in a write-heavy environment where you may read the data that you wrote.
39
39
40
-
The following example uses the `CollectionCallback` to return information about an index:
40
+
The following example uses the javadoc:org.springframework.data.mongodb.core.CollectionCallback[] to return information about an index:
41
41
42
42
[tabs]
43
43
======
@@ -108,7 +108,7 @@ Flux<Jedi> all = template.query(SWCharacter.class)
108
108
======
109
109
110
110
NOTE: Using projections allows `MongoTemplate` to optimize result mapping by limiting the actual response to fields required
111
-
by the projection target type. This applies as long as the `Query` itself does not contain any field restriction and the
111
+
by the projection target type. This applies as long as the javadoc:org.springframework.data.mongodb.core.query.Query[] itself does not contain any field restriction and the
112
112
target type is a closed interface or DTO projection.
113
113
114
114
WARNING: Projections must not be applied to xref:mongodb/mapping/document-references.adoc[DBRefs].
@@ -158,7 +158,7 @@ Look into the implementation for more details on the mapping.
158
158
[[mongo-template.type-mapping]]
159
159
== Domain Type Mapping
160
160
161
-
The mapping between MongoDB documents and domain classes is done by delegating to an implementation of the `MongoConverter` interface.
162
-
Spring provides `MappingMongoConverter`, but you can also write your own converter.
161
+
The mapping between MongoDB documents and domain classes is done by delegating to an implementation of the javadoc:org.springframework.data.mongodb.core.convert.MongoConverter[] interface.
162
+
Spring provides javadoc:org.springframework.data.mongodb.core.convert.MappingMongoConverter[], but you can also write your own converter.
163
163
While the `MappingMongoConverter` can use additional metadata to specify the mapping of objects to documents, it can also convert objects that contain no additional metadata by using some conventions for the mapping of IDs and collection names.
164
164
These conventions, as well as the use of mapping annotations, are explained in the xref:mongodb/mapping/mapping.adoc[Mapping] chapter.
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/mongodb/template-config.adoc
+2-2
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ XML::
57
57
----
58
58
======
59
59
60
-
There are several overloaded constructors of `MongoTemplate` and `ReactiveMongoTemplate`:
60
+
There are several overloaded constructors of javadoc:org.springframework.data.mongodb.core.MongoTemplate[] and javadoc:org.springframework.data.mongodb.core.ReactiveMongoTemplate[]:
61
61
62
62
* `MongoTemplate(MongoClient mongo, String databaseName)`: Takes the `MongoClient` object and the default database name to operate against.
63
63
* `MongoTemplate(MongoDatabaseFactory mongoDbFactory)`: Takes a MongoDbFactory object that encapsulated the `MongoClient` object, database name, and username and password.
By setting `MongoTemplate#useEstimatedCount(...)` to `true` _MongoTemplate#count(...)_ operations, that use an empty filter query, will be delegated to `estimatedCount`, as long as there is no transaction active and the template is not bound to a xref:mongodb/client-session-transactions.adoc[session].
167
-
Please refer to to the xref:mongodb/template-document-count.adoc#mongo.query.count[Counting Documents] section for more information.
167
+
Please refer to the xref:mongodb/template-document-count.adoc#mongo.query.count[Counting Documents] section for more information.
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/mongodb/template-gridfs.adoc
+1-1
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
= GridFS Support
3
3
4
4
MongoDB supports storing binary files inside its filesystem, GridFS.
5
-
Spring Data MongoDB provides a `GridFsOperations` and `ReactiveGridFsOperations` interface as well as the corresponding implementation, `GridFsTemplate` and `ReactiveGridFsTemplate`, to let you interact with the filesystem.
5
+
Spring Data MongoDB provides a javadoc:org.springframework.data.mongodb.gridfs.GridFsOperations[] and javadoc:org.springframework.data.mongodb.gridfs.ReactiveGridFsOperations[] interface as well as the corresponding implementation, `GridFsTemplate` and `ReactiveGridFsTemplate`, to let you interact with the filesystem.
6
6
You can set up a template instance by handing it a `MongoDatabaseFactory`/`ReactiveMongoDatabaseFactory` as well as a `MongoConverter`, as the following example shows:
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/mongodb/template-query-operations.adoc
+2-2
Original file line number
Diff line number
Diff line change
@@ -472,7 +472,7 @@ The `Metrics` enum used here actually implements an interface so that other metr
472
472
A `Metric` is backed by a multiplier to transform the distance value of the given metric into native distances.
473
473
The sample shown here would consider the 10 to be miles. Using one of the built-in metrics (miles and kilometers) automatically triggers the spherical flag to be set on the query.
474
474
If you want to avoid that, pass plain `double` values into `maxDistance(…)`.
475
-
For more information, see the https://docs.spring.io/spring-data/mongodb/docs/{version}/api/index.html[JavaDoc] of `NearQuery` and `Distance`.
475
+
For more information, see the Javadoc of javadoc:org.springframework.data.mongodb.core.query.NearQuery[] and `Distance`.
476
476
477
477
The geo-near operations return a `GeoResults` wrapper object that encapsulates `GeoResult` instances.
478
478
Wrapping `GeoResults` allows accessing the average distance of all results.
@@ -486,7 +486,7 @@ MongoDB supports https://geojson.org/[GeoJSON] and simple (legacy) coordinate pa
486
486
[[mongo.geo-json.domain.classes]]
487
487
== GeoJSON Types in Domain Classes
488
488
489
-
Usage of https://geojson.org/[GeoJSON] types in domain classes is straightforward. The `org.springframework.data.mongodb.core.geo` package contains types such as `GeoJsonPoint`, `GeoJsonPolygon`, and others. These types are extend the existing `org.springframework.data.geo` types. The following example uses a `GeoJsonPoint`:
489
+
Usage of https://geojson.org/[GeoJSON] types in domain classes is straightforward. The `org.springframework.data.mongodb.core.geo` package contains types such as `GeoJsonPoint`, `GeoJsonPolygon`, and others. These types are extend the existing `org.springframework.data.geo` types. The following example uses a javadoc:org.springframework.data.mongodb.core.geo.GeoJsonPoint[]:
0 commit comments