@ -39,39 +41,39 @@ public abstract class AbstractReactiveMongoConfiguration extends MongoConfigurat
@@ -39,39 +41,39 @@ public abstract class AbstractReactiveMongoConfiguration extends MongoConfigurat
@ -121,6 +122,7 @@ public class MappingMongoConverterParser implements BeanDefinitionParser {
@@ -121,6 +122,7 @@ public class MappingMongoConverterParser implements BeanDefinitionParser {
@ -129,9 +131,7 @@ public class MappingMongoConverterParser implements BeanDefinitionParser {
@@ -129,9 +131,7 @@ public class MappingMongoConverterParser implements BeanDefinitionParser {
@ -65,19 +65,18 @@ public class DefaultIndexOperations implements IndexOperations {
@@ -65,19 +65,18 @@ public class DefaultIndexOperations implements IndexOperations {
@ -86,11 +85,10 @@ public class DefaultIndexOperations implements IndexOperations {
@@ -86,11 +85,10 @@ public class DefaultIndexOperations implements IndexOperations {
@ -110,6 +108,7 @@ public class DefaultIndexOperations implements IndexOperations {
@@ -110,6 +108,7 @@ public class DefaultIndexOperations implements IndexOperations {
@ -124,7 +123,7 @@ public class DefaultIndexOperations implements IndexOperations {
@@ -124,7 +123,7 @@ public class DefaultIndexOperations implements IndexOperations {
@ -62,7 +62,7 @@ public class DefaultReactiveIndexOperations implements ReactiveIndexOperations {
@@ -62,7 +62,7 @@ public class DefaultReactiveIndexOperations implements ReactiveIndexOperations {
@ -96,7 +96,7 @@ public class DefaultReactiveIndexOperations implements ReactiveIndexOperations {
@@ -96,7 +96,7 @@ public class DefaultReactiveIndexOperations implements ReactiveIndexOperations {
@ -122,6 +124,6 @@ public class ReactiveMongoClientFactoryBean extends AbstractFactoryBean<MongoCli
@@ -122,6 +124,6 @@ public class ReactiveMongoClientFactoryBean extends AbstractFactoryBean<MongoCli
@ -211,7 +209,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -211,7 +209,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -329,20 +327,6 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -329,20 +327,6 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -480,7 +464,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -480,7 +464,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -495,7 +479,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -495,7 +479,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -730,7 +714,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -730,7 +714,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -777,7 +761,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -777,7 +761,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -904,7 +888,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -904,7 +888,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -1094,7 +1078,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -1094,7 +1078,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -1194,12 +1178,12 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -1194,12 +1178,12 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -1413,7 +1397,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -1413,7 +1397,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
thrownewInvalidDataAccessApiUsageException("Query passed in to remove can't be null!");
@ -1437,7 +1421,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -1437,7 +1421,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
if(LOGGER.isDebugEnabled()){
LOGGER.debug("Remove using query: {} in collection: {}.",
@ -1534,7 +1518,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -1534,7 +1518,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -1596,17 +1580,17 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -1596,17 +1580,17 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -1654,7 +1638,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -1654,7 +1638,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
LOGGER.debug(String.format("findAndRemove using query: %s fields: %s sort: %s for class: %s in collection: %s",
@ -1668,7 +1652,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -1668,7 +1652,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -1687,13 +1671,10 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -1687,13 +1671,10 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -1828,7 +1809,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -1828,7 +1809,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -1846,14 +1827,14 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -1846,14 +1827,14 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -1921,7 +1902,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -1921,7 +1902,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -2137,7 +2118,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -2137,7 +2118,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -2160,7 +2141,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -2160,7 +2141,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -2299,29 +2280,29 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -2299,29 +2280,29 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -2336,13 +2317,13 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -2336,13 +2317,13 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -2353,8 +2334,8 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -2353,8 +2334,8 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -2371,13 +2352,13 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -2371,13 +2352,13 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -2391,55 +2372,4 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@@ -2391,55 +2372,4 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati
@ -61,7 +61,7 @@ public class MongoRepositoryConfigurationExtension extends RepositoryConfigurati
@@ -61,7 +61,7 @@ public class MongoRepositoryConfigurationExtension extends RepositoryConfigurati
@ -152,7 +152,7 @@ public class MongoRepositoryConfigurationExtension extends RepositoryConfigurati
@@ -152,7 +152,7 @@ public class MongoRepositoryConfigurationExtension extends RepositoryConfigurati
@ -161,11 +163,8 @@ public class ReactiveMongoRepositoryConfigurationExtension extends RepositoryCon
@@ -161,11 +163,8 @@ public class ReactiveMongoRepositoryConfigurationExtension extends RepositoryCon
@ -147,4 +150,21 @@ public class ReactiveMongoQueryMethod extends MongoQueryMethod {
@@ -147,4 +150,21 @@ public class ReactiveMongoQueryMethod extends MongoQueryMethod {
@ -52,7 +55,7 @@ public class ReactivePartTreeMongoQuery extends AbstractReactiveMongoQuery {
@@ -52,7 +55,7 @@ public class ReactivePartTreeMongoQuery extends AbstractReactiveMongoQuery {
@ -90,19 +93,14 @@ public class ReactivePartTreeMongoQuery extends AbstractReactiveMongoQuery {
@@ -90,19 +93,14 @@ public class ReactivePartTreeMongoQuery extends AbstractReactiveMongoQuery {
@ -110,7 +108,7 @@ public class ReactivePartTreeMongoQuery extends AbstractReactiveMongoQuery {
@@ -110,7 +108,7 @@ public class ReactivePartTreeMongoQuery extends AbstractReactiveMongoQuery {
@ -60,7 +62,7 @@ public class ReactiveStringBasedMongoQuery extends AbstractReactiveMongoQuery {
@@ -60,7 +62,7 @@ public class ReactiveStringBasedMongoQuery extends AbstractReactiveMongoQuery {
@ -75,7 +77,7 @@ public class ReactiveStringBasedMongoQuery extends AbstractReactiveMongoQuery {
@@ -75,7 +77,7 @@ public class ReactiveStringBasedMongoQuery extends AbstractReactiveMongoQuery {
@ -86,17 +89,22 @@ public class MongoRepositoryFactory extends RepositoryFactorySupport {
@@ -86,17 +89,22 @@ public class MongoRepositoryFactory extends RepositoryFactorySupport {
@ -140,7 +141,7 @@ public class ReactiveMongoRepositoryFactory extends RepositoryFactorySupport {
@@ -140,7 +141,7 @@ public class ReactiveMongoRepositoryFactory extends RepositoryFactorySupport {
@ -212,7 +213,7 @@ public class ReactiveMongoRepositoryFactory extends RepositoryFactorySupport {
@@ -212,7 +213,7 @@ public class ReactiveMongoRepositoryFactory extends RepositoryFactorySupport {
@ -216,9 +216,7 @@ public class SimpleReactiveMongoRepository<T, ID extends Serializable> implement
@@ -216,9 +216,7 @@ public class SimpleReactiveMongoRepository<T, ID extends Serializable> implement
Assert.notNull(entities,"The given Publisher of entities must not be null!");
@ -272,15 +270,17 @@ public class SimpleReactiveMongoRepository<T, ID extends Serializable> implement
@@ -272,15 +270,17 @@ public class SimpleReactiveMongoRepository<T, ID extends Serializable> implement
});
}
// TODO: should this one really be void?
publicMono<Void>delete(IDid){
Assert.notNull(id,"The given id must not be null!");
Assert.notNull(entity,"The given entity must not be null!");
@ -288,6 +288,7 @@ public class SimpleReactiveMongoRepository<T, ID extends Serializable> implement
@@ -288,6 +288,7 @@ public class SimpleReactiveMongoRepository<T, ID extends Serializable> implement
Assert.notNull(entities,"The given Iterable of entities must not be null!");
@ -295,6 +296,7 @@ public class SimpleReactiveMongoRepository<T, ID extends Serializable> implement
@@ -295,6 +296,7 @@ public class SimpleReactiveMongoRepository<T, ID extends Serializable> implement
@ -303,6 +305,7 @@ public class SimpleReactiveMongoRepository<T, ID extends Serializable> implement
@@ -303,6 +305,7 @@ public class SimpleReactiveMongoRepository<T, ID extends Serializable> implement
@ -74,7 +74,6 @@ public class AbstractReactiveMongoConfigurationUnitTests {
@@ -74,7 +74,6 @@ public class AbstractReactiveMongoConfigurationUnitTests {
@ -64,8 +63,8 @@ public class MongoPersistentEntityIndexCreatorIntegrationTests {
@@ -64,8 +63,8 @@ public class MongoPersistentEntityIndexCreatorIntegrationTests {
@ -113,11 +112,11 @@ public class MongoPersistentEntityIndexCreatorIntegrationTests {
@@ -113,11 +112,11 @@ public class MongoPersistentEntityIndexCreatorIntegrationTests {
@ -83,7 +84,7 @@ public class ReactiveMongoRepositoryTests implements BeanClassLoaderAware, BeanF
@@ -83,7 +84,7 @@ public class ReactiveMongoRepositoryTests implements BeanClassLoaderAware, BeanF
@ -70,7 +71,7 @@ public class SimpleReactiveMongoRepositoryTests implements BeanClassLoaderAware,
@@ -70,7 +71,7 @@ public class SimpleReactiveMongoRepositoryTests implements BeanClassLoaderAware,
@ -11,7 +11,7 @@ This chapter will point out the specialties for reactive repository support for
@@ -11,7 +11,7 @@ This chapter will point out the specialties for reactive repository support for
The reactive space offers various reactive composition libraries. The most common libraries are https://github.com/ReactiveX/RxJava[RxJava] and https://projectreactor.io/[Project Reactor].
Spring Data MongoDB is built on top of the MongoDB Reactive Streams driver to provide maximal interoperability relying on the http://www.reactive-streams.org/[Reactive Streams] initiative. Static APIs such as `ReactiveMongoOperations` are provided by using Project Reactor's `Flux` and `Mono` types. Project Reactor offers various adapters to convert reactive wrapper types (`Flux` to `Observable` and vice versa) but conversion can easily clutter your code.
Spring Data MongoDB is built on top of the https://mongodb.github.io/mongo-java-driver-reactivestreams/[MongoDB Reactive Streams] driver to provide maximal interoperability relying on the http://www.reactive-streams.org/[Reactive Streams] initiative. Static APIs such as `ReactiveMongoOperations` are provided by using Project Reactor's `Flux` and `Mono` types. Project Reactor offers various adapters to convert reactive wrapper types (`Flux` to `Observable` and vice versa) but conversion can easily clutter your code.
Spring Data's Repository abstraction is a dynamic API, mostly defined by you and your requirements, as you're declaring query methods. Reactive MongoDB repositories can be either implemented using RxJava or Project Reactor wrapper types by simply extending from one of the library-specific repository interfaces:
@ -99,21 +99,17 @@ As our domain repository extends `ReactivePagingAndSortingRepository` it provide
@@ -99,21 +99,17 @@ As our domain repository extends `ReactivePagingAndSortingRepository` it provide
The reactive MongoDB support contains a basic set of features which are summarized below.
* Spring configuration support using Java based @Configuration classes a Mongo client instance and replica sets
* `ReactiveMongoTemplate` helper class that increases productivity using Mongo operations in a reactive manner. Includes integrated object mapping between documents and POJOs.
* Exception translation into Spring's portable Data Access Exception hierarchy
* Feature Rich Object Mapping integrated with Spring's ConversionService
* Annotation based mapping metadata but extensible to support other metadata formats
* Persistence and mapping lifecycle events
* Java based Query, Criteria, and Update DSLs
* Spring configuration support using Java based `@Configuration` classes a `MongoClient` instance and replica sets.
* `ReactiveMongoTemplate` helper class that increases productivity using `MongoOperations in a reactive manner. Includes integrated object mapping between `Documents and POJOs.
* Exception translation into Spring's portable Data Access Exception hierarchy.
* Feature Rich Object Mapping integrated with Spring's `ConversionService`.
* Annotation based mapping metadata but extensible to support other metadata formats.
* Persistence and mapping lifecycle events.
* Java based `Query`, `Criteria`, and `Update` DSLs.
* Automatic implementation of reactive Repository interfaces including support for custom finder methods.
For most tasks you will find yourself using `ReactiveMongoTemplate` or the Repository support that both leverage the rich mapping functionality. `ReactiveMongoTemplate` is the place to look for accessing functionality such as incrementing counters or ad-hoc CRUD operations. `ReactiveMongoTemplate` also provides callback methods so that it is easy for you to get a hold of the low level API artifacts such as `MongoDatabase` to communicate directly with MongoDB. The goal with naming conventions on various API artifacts is to copy those in the base MongoDB Java driver so you can easily map your existing knowledge onto the Spring APIs.
@ -54,12 +54,11 @@ Then add the following to pom.xml dependencies section.
@@ -54,12 +54,11 @@ Then add the following to pom.xml dependencies section.
NOTE: MongoDB uses two different drivers for blocking and reactive (non-blocking) data access. While blocking operations are provided by default, you're have to opt-in for reactive usage.
Create a simple Person class to persist:
Create a simple `Person` class to persist:
[source,java]
----
package org.spring.mongodb.example;
@Document
public class Person {
private String id;
@ -92,17 +91,6 @@ And a main application to run
@@ -92,17 +91,6 @@ And a main application to run
@ -181,7 +164,7 @@ public class AppConfig {
@@ -181,7 +164,7 @@ public class AppConfig {
This approach allows you to use the standard `com.mongodb.reactivestreams.client.MongoClient` API that you may already be used to using.
An alternative is to register an instance of `com.mongodb.reactivestreams.client.MongoClient` instance with the container using Spring's `ReactiveMongoClientFactoryBean`. As compared to instantiating a `com.mongodb.reactivestreams.client.MongoClient` instance directly, the FactoryBean approach has the added advantage of also providing the container with an ExceptionTranslator implementation that translates MongoDB exceptions to exceptions in Spring's portable `DataAccessException` hierarchy for data access classes annotated with the `@Repository` annotation. This hierarchy and use of `@Repository` is described in http://docs.spring.io/spring/docs/{springVersion}/spring-framework-reference/html/dao.html[Spring's DAO support features].
An alternative is to register an instance of `com.mongodb.reactivestreams.client.MongoClient` instance with the container using Spring's `ReactiveMongoClientFactoryBean`. As compared to instantiating a `com.mongodb.reactivestreams.client.MongoClient` instance directly, the FactoryBean approach has the added advantage of also providing the container with an `ExceptionTranslator` implementation that translates MongoDB exceptions to exceptions in Spring's portable `DataAccessException` hierarchy for data access classes annotated with the `@Repository` annotation. This hierarchy and use of `@Repository` is described in http://docs.spring.io/spring/docs/{springVersion}/spring-framework-reference/html/dao.html[Spring's DAO support features].
An example of a Java based bean metadata that supports exception translation on `@Repository` annotated classes is shown below:
@ -197,16 +180,16 @@ public class AppConfig {
@@ -197,16 +180,16 @@ public class AppConfig {
*/
public @Bean ReactiveMongoClientFactoryBean mongoClient() {
ReactiveMongoClientFactoryBean mongoClient = new ReactiveMongoClientFactoryBean();
mongoClient.setHost("localhost");
ReactiveMongoClientFactoryBean clientFactory = new ReactiveMongoClientFactoryBean();
clientFactory.setHost("localhost");
return mongoClient;
return clientFactory;
}
}
----
====
To access the `com.mongodb.reactivestreams.client.MongoClient` object created by the `ReactiveMongoClientFactoryBean` in other `@Configuration` or your own classes, use a `private @Autowired MongoClient mongoClient;` field.
To access the `com.mongodb.reactivestreams.client.MongoClient` object created by the `ReactiveMongoClientFactoryBean` in other `@Configuration` or your own classes, just obtain the `MongoClient` from the context.
[[mongo.mongo-db-factory]]
@ -246,7 +229,7 @@ public interface ReactiveMongoDatabaseFactory {
@@ -246,7 +229,7 @@ public interface ReactiveMongoDatabaseFactory {
The class `org.springframework.data.mongodb.core.SimpleReactiveMongoDatabaseFactory` provides implements the ReactiveMongoDatabaseFactory interface and is created with a standard `com.mongodb.reactivestreams.client.MongoClient` instance and the database name.
Instead of using the IoC container to create an instance of ReactiveMongoTemplate, you can just use them in standard Java code as shown below.
Instead of using the IoC container to create an instance of `ReactiveMongoTemplate`, you can just use them in standard Java code as shown below.
[source,java]
----
@ -256,27 +239,23 @@ public class MongoApp {
@@ -256,27 +239,23 @@ public class MongoApp {
public static void main(String[] args) throws Exception {
ReactiveMongoOperations mongoOps = new ReactiveMongoOperations(*new SimpleReactiveMongoDatabaseFactory(MongoClient.create(), "database")*);
ReactiveMongoOperations mongoOps = new ReactiveMongoOperations(new SimpleReactiveMongoDatabaseFactory(MongoClient.create(), "database"));
The code in bold highlights the use of SimpleMongoDbFactory and is the only difference between the listing shown in the <<mongodb-reactive-getting-started,getting started section>>.
The use of `SimpleMongoDbFactory` is the only difference between the listing shown in the <<mongodb-reactive-getting-started,getting started section>>.
[[mongo.mongo-db-factory-java]]
=== Registering a ReactiveMongoDatabaseFactory instance using Java based metadata
To register a ReactiveMongoDatabaseFactory instance with the container, you write code much like what was highlighted in the previous code listing. A simple example is shown below
To register a `ReactiveMongoDatabaseFactory` instance with the container, you write code much like what was highlighted in the previous code listing. A simple example is shown below
[source,java]
----
@ -315,7 +294,7 @@ NOTE: Once configured, `ReactiveMongoTemplate` is thread-safe and can be reused
@@ -315,7 +294,7 @@ NOTE: Once configured, `ReactiveMongoTemplate` is thread-safe and can be reused
The mapping between MongoDB documents and domain classes is done by delegating to an implementation of the interface `MongoConverter`. Spring provides a default implementation with `MongoMappingConverter`, but you can also write your own converter. Please refer to the section on MongoConverters for more detailed information.
The `ReactiveMongoTemplate` class implements the interface `ReactiveMongoOperations`. In as much as possible, the methods on `ReactiveMongoOperations` are named after methods available on the MongoDB driver `Collection` object as as to make the API familiar to existing MongoDB developers who are used to the driver API. For example, you will find methods such as "find", "findAndModify", "findOne", "insert", "remove", "save", "update" and "updateMulti". The design goal was to make it as easy as possible to transition between the use of the base MongoDB driver and `ReactiveMongoOperations`. A major difference in between the two APIs is that ReactiveMongoOperations can be passed domain objects instead of `Document` and there are fluent APIs for `Query`, `Criteria`, and `Update` operations instead of populating a `Document` to specify the parameters for those operations.
The `ReactiveMongoTemplate` class implements the interface `ReactiveMongoOperations`. In as much as possible, the methods on `ReactiveMongoOperations` are named after methods available on the MongoDB driver `Collection` object as as to make the API familiar to existing MongoDB developers who are used to the driver API. For example, you will find methods such as "find", "findAndModify", "findOne", "insert", "remove", "save", "update" and "updateMulti". The design goal was to make it as easy as possible to transition between the use of the base MongoDB driver and `ReactiveMongoOperations`. A major difference in between the two APIs is that `ReactiveMongoOperations` can be passed domain objects instead of `Document` and there are fluent APIs for `Query`, `Criteria`, and `Update` operations instead of populating a `Document` to specify the parameters for those operations.
NOTE: The preferred way to reference the operations on `ReactiveMongoTemplate` instance is via its interface `ReactiveMongoOperations`.
@ -350,7 +329,7 @@ public class AppConfig {
@@ -350,7 +329,7 @@ public class AppConfig {
----
====
There are several overloaded constructors of ReactiveMongoTemplate. These are
There are several overloaded constructors of `ReactiveMongoTemplate`. These are
* `ReactiveMongoTemplate(MongoClient mongo, String databaseName)` - takes the `com.mongodb.Mongo` object and the default database name to operate against.
* `ReactiveMongoTemplate(ReactiveMongoDatabaseFactory mongoDatabaseFactory)` - takes a ReactiveMongoDatabaseFactory object that encapsulated the `com.mongodb.reactivestreams.client.MongoClient` object and database name.
@ -364,13 +343,13 @@ NOTE: The preferred way to reference the operations on `ReactiveMongoTemplate` i
@@ -364,13 +343,13 @@ NOTE: The preferred way to reference the operations on `ReactiveMongoTemplate` i
[[mongo.reactive.template.writeresultchecking]]
=== WriteResultChecking Policy
When in development it is very handy to either log or throw an exception if the `com.mongodb.WriteResult` returned from any MongoDB operation contains an error. It is quite common to forget to do this during development and then end up with an application that looks like it runs successfully but in fact the database was not modified according to your expectations. Set MongoTemplate's property to an enum with the following values, `LOG`, `EXCEPTION`, or `NONE` to either log the error, throw and exception or do nothing. The default is to use a `WriteResultChecking` value of `NONE`.
When in development it is very handy to either log or throw an `Exception` if the `com.mongodb.WriteResult` returned from any MongoDB operation contains an error. It is quite common to forget to do this during development and then end up with an application that looks like it runs successfully but in fact the database was not modified according to your expectations. Set MongoTemplate's property to an enum with the following values, `LOG`, `EXCEPTION`, or `NONE` to either log the error, throw and exception or do nothing. The default is to use a `WriteResultChecking` value of `NONE`.
[[mongo.reactive.template.writeconcern]]
=== WriteConcern
You can set the `com.mongodb.WriteConcern` property that the `ReactiveMongoTemplate` will use for write operations if it has not yet been specified via the driver at a higher level such as `MongoDatabase`. If ReactiveMongoTemplate's `WriteConcern` property is not set it will default to the one set in the MongoDB driver's DB or Collection setting.
You can set the `com.mongodb.WriteConcern` property that the `ReactiveMongoTemplate` will use for write operations if it has not yet been specified via the driver at a higher level such as `MongoDatabase`. If ReactiveMongoTemplate's `WriteConcern` property is not set it will default to the one set in the MongoDB driver's `MongoDatabase` or `MongoCollection` setting.
[[mongo.reactive.template.writeconcernresolver]]
@ -445,17 +424,6 @@ You can save, update and delete the object as shown below.
@@ -445,17 +424,6 @@ You can save, update and delete the object as shown below.
@ -529,14 +492,9 @@ Here is an example that uses the `ReactiveCollectionCallback` to return informat
@@ -529,14 +492,9 @@ Here is an example that uses the `ReactiveCollectionCallback` to return informat