|
|
|
@ -349,6 +349,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) |
|
|
|
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
|
|
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
|
|
|
|
|
|
|
|
|
|
|
prepareIndexCreator(applicationContext); |
|
|
|
prepareIndexCreator(applicationContext); |
|
|
|
@ -454,6 +455,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* |
|
|
|
* |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public MongoConverter getConverter() { |
|
|
|
public MongoConverter getConverter() { |
|
|
|
return this.mongoConverter; |
|
|
|
return this.mongoConverter; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -462,6 +464,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#reactiveIndexOps(java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#reactiveIndexOps(java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public ReactiveIndexOperations indexOps(String collectionName) { |
|
|
|
public ReactiveIndexOperations indexOps(String collectionName) { |
|
|
|
return new DefaultReactiveIndexOperations(this, collectionName, this.queryMapper); |
|
|
|
return new DefaultReactiveIndexOperations(this, collectionName, this.queryMapper); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -470,10 +473,12 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#reactiveIndexOps(java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#reactiveIndexOps(java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public ReactiveIndexOperations indexOps(Class<?> entityClass) { |
|
|
|
public ReactiveIndexOperations indexOps(Class<?> entityClass) { |
|
|
|
return new DefaultReactiveIndexOperations(this, getCollectionName(entityClass), this.queryMapper, entityClass); |
|
|
|
return new DefaultReactiveIndexOperations(this, getCollectionName(entityClass), this.queryMapper, entityClass); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public String getCollectionName(Class<?> entityClass) { |
|
|
|
public String getCollectionName(Class<?> entityClass) { |
|
|
|
return operations.determineCollectionName(entityClass); |
|
|
|
return operations.determineCollectionName(entityClass); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -482,6 +487,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#executeCommand(java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#executeCommand(java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<Document> executeCommand(String jsonCommand) { |
|
|
|
public Mono<Document> executeCommand(String jsonCommand) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(jsonCommand, "Command must not be empty!"); |
|
|
|
Assert.notNull(jsonCommand, "Command must not be empty!"); |
|
|
|
@ -493,6 +499,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#executeCommand(org.bson.Document) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#executeCommand(org.bson.Document) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<Document> executeCommand(Document command) { |
|
|
|
public Mono<Document> executeCommand(Document command) { |
|
|
|
return executeCommand(command, null); |
|
|
|
return executeCommand(command, null); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -501,6 +508,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#executeCommand(org.bson.Document, com.mongodb.ReadPreference) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#executeCommand(org.bson.Document, com.mongodb.ReadPreference) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<Document> executeCommand(Document command, @Nullable ReadPreference readPreference) { |
|
|
|
public Mono<Document> executeCommand(Document command, @Nullable ReadPreference readPreference) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(command, "Command must not be null!"); |
|
|
|
Assert.notNull(command, "Command must not be null!"); |
|
|
|
@ -531,6 +539,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#execute(java.lang.String, org.springframework.data.mongodb.core.ReactiveCollectionCallback) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#execute(java.lang.String, org.springframework.data.mongodb.core.ReactiveCollectionCallback) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Flux<T> execute(String collectionName, ReactiveCollectionCallback<T> callback) { |
|
|
|
public <T> Flux<T> execute(String collectionName, ReactiveCollectionCallback<T> callback) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(callback, "ReactiveCollectionCallback must not be null!"); |
|
|
|
Assert.notNull(callback, "ReactiveCollectionCallback must not be null!"); |
|
|
|
@ -628,6 +637,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#withSession(com.mongodb.session.ClientSession) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#withSession(com.mongodb.session.ClientSession) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public ReactiveMongoOperations withSession(ClientSession session) { |
|
|
|
public ReactiveMongoOperations withSession(ClientSession session) { |
|
|
|
return new ReactiveSessionBoundMongoTemplate(session, ReactiveMongoTemplate.this); |
|
|
|
return new ReactiveSessionBoundMongoTemplate(session, ReactiveMongoTemplate.this); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -713,6 +723,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#createCollection(java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#createCollection(java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<MongoCollection<Document>> createCollection(Class<T> entityClass) { |
|
|
|
public <T> Mono<MongoCollection<Document>> createCollection(Class<T> entityClass) { |
|
|
|
return createCollection(entityClass, operations.forType(entityClass).getCollectionOptions()); |
|
|
|
return createCollection(entityClass, operations.forType(entityClass).getCollectionOptions()); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -721,6 +732,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#createCollection(java.lang.Class, org.springframework.data.mongodb.core.CollectionOptions) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#createCollection(java.lang.Class, org.springframework.data.mongodb.core.CollectionOptions) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<MongoCollection<Document>> createCollection(Class<T> entityClass, |
|
|
|
public <T> Mono<MongoCollection<Document>> createCollection(Class<T> entityClass, |
|
|
|
@Nullable CollectionOptions collectionOptions) { |
|
|
|
@Nullable CollectionOptions collectionOptions) { |
|
|
|
|
|
|
|
|
|
|
|
@ -734,6 +746,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#createCollection(java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#createCollection(java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<MongoCollection<Document>> createCollection(String collectionName) { |
|
|
|
public Mono<MongoCollection<Document>> createCollection(String collectionName) { |
|
|
|
return doCreateCollection(collectionName, new CreateCollectionOptions()); |
|
|
|
return doCreateCollection(collectionName, new CreateCollectionOptions()); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -742,6 +755,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#createCollection(java.lang.String, org.springframework.data.mongodb.core.CollectionOptions) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#createCollection(java.lang.String, org.springframework.data.mongodb.core.CollectionOptions) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<MongoCollection<Document>> createCollection(String collectionName, |
|
|
|
public Mono<MongoCollection<Document>> createCollection(String collectionName, |
|
|
|
@Nullable CollectionOptions collectionOptions) { |
|
|
|
@Nullable CollectionOptions collectionOptions) { |
|
|
|
return doCreateCollection(collectionName, convertToCreateCollectionOptions(collectionOptions)); |
|
|
|
return doCreateCollection(collectionName, convertToCreateCollectionOptions(collectionOptions)); |
|
|
|
@ -751,6 +765,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#getCollection(java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#getCollection(java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<MongoCollection<Document>> getCollection(String collectionName) { |
|
|
|
public Mono<MongoCollection<Document>> getCollection(String collectionName) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(collectionName, "Collection name must not be null!"); |
|
|
|
Assert.notNull(collectionName, "Collection name must not be null!"); |
|
|
|
@ -762,6 +777,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#collectionExists(java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#collectionExists(java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<Boolean> collectionExists(Class<T> entityClass) { |
|
|
|
public <T> Mono<Boolean> collectionExists(Class<T> entityClass) { |
|
|
|
return collectionExists(getCollectionName(entityClass)); |
|
|
|
return collectionExists(getCollectionName(entityClass)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -770,6 +786,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#collectionExists(java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#collectionExists(java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<Boolean> collectionExists(String collectionName) { |
|
|
|
public Mono<Boolean> collectionExists(String collectionName) { |
|
|
|
return createMono(db -> Flux.from(db.listCollectionNames()) //
|
|
|
|
return createMono(db -> Flux.from(db.listCollectionNames()) //
|
|
|
|
.filter(s -> s.equals(collectionName)) //
|
|
|
|
.filter(s -> s.equals(collectionName)) //
|
|
|
|
@ -781,6 +798,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#dropCollection(java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#dropCollection(java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<Void> dropCollection(Class<T> entityClass) { |
|
|
|
public <T> Mono<Void> dropCollection(Class<T> entityClass) { |
|
|
|
return dropCollection(getCollectionName(entityClass)); |
|
|
|
return dropCollection(getCollectionName(entityClass)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -789,6 +807,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#dropCollection(java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#dropCollection(java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<Void> dropCollection(String collectionName) { |
|
|
|
public Mono<Void> dropCollection(String collectionName) { |
|
|
|
|
|
|
|
|
|
|
|
return createMono(collectionName, MongoCollection::drop).doOnSuccess(success -> { |
|
|
|
return createMono(collectionName, MongoCollection::drop).doOnSuccess(success -> { |
|
|
|
@ -802,6 +821,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#getCollectionNames() |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#getCollectionNames() |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Flux<String> getCollectionNames() { |
|
|
|
public Flux<String> getCollectionNames() { |
|
|
|
return createFlux(MongoDatabase::listCollectionNames); |
|
|
|
return createFlux(MongoDatabase::listCollectionNames); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -818,6 +838,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findOne(org.springframework.data.mongodb.core.query.Query, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findOne(org.springframework.data.mongodb.core.query.Query, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<T> findOne(Query query, Class<T> entityClass) { |
|
|
|
public <T> Mono<T> findOne(Query query, Class<T> entityClass) { |
|
|
|
return findOne(query, entityClass, getCollectionName(entityClass)); |
|
|
|
return findOne(query, entityClass, getCollectionName(entityClass)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -826,6 +847,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findOne(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findOne(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<T> findOne(Query query, Class<T> entityClass, String collectionName) { |
|
|
|
public <T> Mono<T> findOne(Query query, Class<T> entityClass, String collectionName) { |
|
|
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(query.getSortObject())) { |
|
|
|
if (ObjectUtils.isEmpty(query.getSortObject())) { |
|
|
|
@ -841,6 +863,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#exists(org.springframework.data.mongodb.core.query.Query, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#exists(org.springframework.data.mongodb.core.query.Query, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<Boolean> exists(Query query, Class<?> entityClass) { |
|
|
|
public Mono<Boolean> exists(Query query, Class<?> entityClass) { |
|
|
|
return exists(query, entityClass, getCollectionName(entityClass)); |
|
|
|
return exists(query, entityClass, getCollectionName(entityClass)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -849,6 +872,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#exists(org.springframework.data.mongodb.core.query.Query, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#exists(org.springframework.data.mongodb.core.query.Query, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<Boolean> exists(Query query, String collectionName) { |
|
|
|
public Mono<Boolean> exists(Query query, String collectionName) { |
|
|
|
return exists(query, null, collectionName); |
|
|
|
return exists(query, null, collectionName); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -857,6 +881,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#exists(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#exists(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<Boolean> exists(Query query, @Nullable Class<?> entityClass, String collectionName) { |
|
|
|
public Mono<Boolean> exists(Query query, @Nullable Class<?> entityClass, String collectionName) { |
|
|
|
|
|
|
|
|
|
|
|
if (query == null) { |
|
|
|
if (query == null) { |
|
|
|
@ -885,6 +910,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#find(org.springframework.data.mongodb.core.query.Query, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#find(org.springframework.data.mongodb.core.query.Query, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Flux<T> find(Query query, Class<T> entityClass) { |
|
|
|
public <T> Flux<T> find(Query query, Class<T> entityClass) { |
|
|
|
return find(query, entityClass, getCollectionName(entityClass)); |
|
|
|
return find(query, entityClass, getCollectionName(entityClass)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -893,6 +919,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#find(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#find(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Flux<T> find(@Nullable Query query, Class<T> entityClass, String collectionName) { |
|
|
|
public <T> Flux<T> find(@Nullable Query query, Class<T> entityClass, String collectionName) { |
|
|
|
|
|
|
|
|
|
|
|
if (query == null) { |
|
|
|
if (query == null) { |
|
|
|
@ -907,6 +934,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findById(java.lang.Object, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findById(java.lang.Object, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<T> findById(Object id, Class<T> entityClass) { |
|
|
|
public <T> Mono<T> findById(Object id, Class<T> entityClass) { |
|
|
|
return findById(id, entityClass, getCollectionName(entityClass)); |
|
|
|
return findById(id, entityClass, getCollectionName(entityClass)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -915,6 +943,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findById(java.lang.Object, java.lang.Class, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findById(java.lang.Object, java.lang.Class, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<T> findById(Object id, Class<T> entityClass, String collectionName) { |
|
|
|
public <T> Mono<T> findById(Object id, Class<T> entityClass, String collectionName) { |
|
|
|
|
|
|
|
|
|
|
|
String idKey = operations.getIdPropertyName(entityClass); |
|
|
|
String idKey = operations.getIdPropertyName(entityClass); |
|
|
|
@ -926,6 +955,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findDistinct(org.springframework.data.mongodb.core.query.Query, java.lang.String, java.lang.Class, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findDistinct(org.springframework.data.mongodb.core.query.Query, java.lang.String, java.lang.Class, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Flux<T> findDistinct(Query query, String field, Class<?> entityClass, Class<T> resultClass) { |
|
|
|
public <T> Flux<T> findDistinct(Query query, String field, Class<?> entityClass, Class<T> resultClass) { |
|
|
|
return findDistinct(query, field, getCollectionName(entityClass), entityClass, resultClass); |
|
|
|
return findDistinct(query, field, getCollectionName(entityClass), entityClass, resultClass); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -934,6 +964,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findDistinct(org.springframework.data.mongodb.core.query.Query, java.lang.String, java.lang.String, java.lang.Class, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findDistinct(org.springframework.data.mongodb.core.query.Query, java.lang.String, java.lang.String, java.lang.Class, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
public <T> Flux<T> findDistinct(Query query, String field, String collectionName, Class<?> entityClass, |
|
|
|
public <T> Flux<T> findDistinct(Query query, String field, String collectionName, Class<?> entityClass, |
|
|
|
Class<T> resultClass) { |
|
|
|
Class<T> resultClass) { |
|
|
|
@ -1117,6 +1148,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAndModify(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAndModify(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<T> findAndModify(Query query, UpdateDefinition update, Class<T> entityClass) { |
|
|
|
public <T> Mono<T> findAndModify(Query query, UpdateDefinition update, Class<T> entityClass) { |
|
|
|
return findAndModify(query, update, new FindAndModifyOptions(), entityClass, getCollectionName(entityClass)); |
|
|
|
return findAndModify(query, update, new FindAndModifyOptions(), entityClass, getCollectionName(entityClass)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1125,6 +1157,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAndModify(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAndModify(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<T> findAndModify(Query query, UpdateDefinition update, Class<T> entityClass, String collectionName) { |
|
|
|
public <T> Mono<T> findAndModify(Query query, UpdateDefinition update, Class<T> entityClass, String collectionName) { |
|
|
|
return findAndModify(query, update, new FindAndModifyOptions(), entityClass, collectionName); |
|
|
|
return findAndModify(query, update, new FindAndModifyOptions(), entityClass, collectionName); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1133,6 +1166,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAndModify(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, org.springframework.data.mongodb.core.FindAndModifyOptions, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAndModify(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, org.springframework.data.mongodb.core.FindAndModifyOptions, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<T> findAndModify(Query query, UpdateDefinition update, FindAndModifyOptions options, |
|
|
|
public <T> Mono<T> findAndModify(Query query, UpdateDefinition update, FindAndModifyOptions options, |
|
|
|
Class<T> entityClass) { |
|
|
|
Class<T> entityClass) { |
|
|
|
return findAndModify(query, update, options, entityClass, getCollectionName(entityClass)); |
|
|
|
return findAndModify(query, update, options, entityClass, getCollectionName(entityClass)); |
|
|
|
@ -1142,6 +1176,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAndModify(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, org.springframework.data.mongodb.core.FindAndModifyOptions, java.lang.Class, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAndModify(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, org.springframework.data.mongodb.core.FindAndModifyOptions, java.lang.Class, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<T> findAndModify(Query query, UpdateDefinition update, FindAndModifyOptions options, |
|
|
|
public <T> Mono<T> findAndModify(Query query, UpdateDefinition update, FindAndModifyOptions options, |
|
|
|
Class<T> entityClass, String collectionName) { |
|
|
|
Class<T> entityClass, String collectionName) { |
|
|
|
|
|
|
|
|
|
|
|
@ -1219,6 +1254,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAndRemove(org.springframework.data.mongodb.core.query.Query, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAndRemove(org.springframework.data.mongodb.core.query.Query, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<T> findAndRemove(Query query, Class<T> entityClass) { |
|
|
|
public <T> Mono<T> findAndRemove(Query query, Class<T> entityClass) { |
|
|
|
return findAndRemove(query, entityClass, getCollectionName(entityClass)); |
|
|
|
return findAndRemove(query, entityClass, getCollectionName(entityClass)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1227,6 +1263,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAndRemove(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAndRemove(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<T> findAndRemove(Query query, Class<T> entityClass, String collectionName) { |
|
|
|
public <T> Mono<T> findAndRemove(Query query, Class<T> entityClass, String collectionName) { |
|
|
|
|
|
|
|
|
|
|
|
operations.forType(entityClass).getCollation(query); |
|
|
|
operations.forType(entityClass).getCollation(query); |
|
|
|
@ -1239,6 +1276,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#count(org.springframework.data.mongodb.core.query.Query, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#count(org.springframework.data.mongodb.core.query.Query, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<Long> count(Query query, Class<?> entityClass) { |
|
|
|
public Mono<Long> count(Query query, Class<?> entityClass) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(entityClass, "Entity class must not be null!"); |
|
|
|
Assert.notNull(entityClass, "Entity class must not be null!"); |
|
|
|
@ -1250,6 +1288,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#count(org.springframework.data.mongodb.core.query.Query, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#count(org.springframework.data.mongodb.core.query.Query, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<Long> count(Query query, String collectionName) { |
|
|
|
public Mono<Long> count(Query query, String collectionName) { |
|
|
|
return count(query, null, collectionName); |
|
|
|
return count(query, null, collectionName); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1258,6 +1297,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#count(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#count(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<Long> count(Query query, @Nullable Class<?> entityClass, String collectionName) { |
|
|
|
public Mono<Long> count(Query query, @Nullable Class<?> entityClass, String collectionName) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(query, "Query must not be null!"); |
|
|
|
Assert.notNull(query, "Query must not be null!"); |
|
|
|
@ -1376,6 +1416,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insert(java.lang.Object) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insert(java.lang.Object) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<T> insert(T objectToSave) { |
|
|
|
public <T> Mono<T> insert(T objectToSave) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(objectToSave, "Object to insert must not be null!"); |
|
|
|
Assert.notNull(objectToSave, "Object to insert must not be null!"); |
|
|
|
@ -1388,6 +1429,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insert(java.lang.Object, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insert(java.lang.Object, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<T> insert(T objectToSave, String collectionName) { |
|
|
|
public <T> Mono<T> insert(T objectToSave, String collectionName) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(objectToSave, "Object to insert must not be null!"); |
|
|
|
Assert.notNull(objectToSave, "Object to insert must not be null!"); |
|
|
|
@ -1430,6 +1472,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insert(java.util.Collection, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insert(java.util.Collection, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Flux<T> insert(Collection<? extends T> batchToSave, Class<?> entityClass) { |
|
|
|
public <T> Flux<T> insert(Collection<? extends T> batchToSave, Class<?> entityClass) { |
|
|
|
return doInsertBatch(getCollectionName(entityClass), batchToSave, this.mongoConverter); |
|
|
|
return doInsertBatch(getCollectionName(entityClass), batchToSave, this.mongoConverter); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1438,6 +1481,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insert(java.util.Collection, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insert(java.util.Collection, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Flux<T> insert(Collection<? extends T> batchToSave, String collectionName) { |
|
|
|
public <T> Flux<T> insert(Collection<? extends T> batchToSave, String collectionName) { |
|
|
|
return doInsertBatch(collectionName, batchToSave, this.mongoConverter); |
|
|
|
return doInsertBatch(collectionName, batchToSave, this.mongoConverter); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1446,6 +1490,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insertAll(java.util.Collection) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#insertAll(java.util.Collection) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Flux<T> insertAll(Collection<? extends T> objectsToSave) { |
|
|
|
public <T> Flux<T> insertAll(Collection<? extends T> objectsToSave) { |
|
|
|
return doInsertAll(objectsToSave, this.mongoConverter); |
|
|
|
return doInsertAll(objectsToSave, this.mongoConverter); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1546,6 +1591,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#save(java.lang.Object) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#save(java.lang.Object) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<T> save(T objectToSave) { |
|
|
|
public <T> Mono<T> save(T objectToSave) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(objectToSave, "Object to save must not be null!"); |
|
|
|
Assert.notNull(objectToSave, "Object to save must not be null!"); |
|
|
|
@ -1556,6 +1602,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#save(java.lang.Object, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#save(java.lang.Object, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Mono<T> save(T objectToSave, String collectionName) { |
|
|
|
public <T> Mono<T> save(T objectToSave, String collectionName) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(objectToSave, "Object to save must not be null!"); |
|
|
|
Assert.notNull(objectToSave, "Object to save must not be null!"); |
|
|
|
@ -1751,6 +1798,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#upsert(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#upsert(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<UpdateResult> upsert(Query query, UpdateDefinition update, Class<?> entityClass) { |
|
|
|
public Mono<UpdateResult> upsert(Query query, UpdateDefinition update, Class<?> entityClass) { |
|
|
|
return doUpdate(getCollectionName(entityClass), query, update, entityClass, true, false); |
|
|
|
return doUpdate(getCollectionName(entityClass), query, update, entityClass, true, false); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1759,6 +1807,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#upsert(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#upsert(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<UpdateResult> upsert(Query query, UpdateDefinition update, String collectionName) { |
|
|
|
public Mono<UpdateResult> upsert(Query query, UpdateDefinition update, String collectionName) { |
|
|
|
return doUpdate(collectionName, query, update, null, true, false); |
|
|
|
return doUpdate(collectionName, query, update, null, true, false); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1767,6 +1816,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#upsert(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#upsert(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<UpdateResult> upsert(Query query, UpdateDefinition update, Class<?> entityClass, String collectionName) { |
|
|
|
public Mono<UpdateResult> upsert(Query query, UpdateDefinition update, Class<?> entityClass, String collectionName) { |
|
|
|
return doUpdate(collectionName, query, update, entityClass, true, false); |
|
|
|
return doUpdate(collectionName, query, update, entityClass, true, false); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1775,6 +1825,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc)) |
|
|
|
* (non-Javadoc)) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#updateFirst(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#updateFirst(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<UpdateResult> updateFirst(Query query, UpdateDefinition update, Class<?> entityClass) { |
|
|
|
public Mono<UpdateResult> updateFirst(Query query, UpdateDefinition update, Class<?> entityClass) { |
|
|
|
return doUpdate(getCollectionName(entityClass), query, update, entityClass, false, false); |
|
|
|
return doUpdate(getCollectionName(entityClass), query, update, entityClass, false, false); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1783,6 +1834,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#updateFirst(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#updateFirst(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<UpdateResult> updateFirst(Query query, UpdateDefinition update, String collectionName) { |
|
|
|
public Mono<UpdateResult> updateFirst(Query query, UpdateDefinition update, String collectionName) { |
|
|
|
return doUpdate(collectionName, query, update, null, false, false); |
|
|
|
return doUpdate(collectionName, query, update, null, false, false); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1791,6 +1843,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#updateFirst(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#updateFirst(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<UpdateResult> updateFirst(Query query, UpdateDefinition update, Class<?> entityClass, |
|
|
|
public Mono<UpdateResult> updateFirst(Query query, UpdateDefinition update, Class<?> entityClass, |
|
|
|
String collectionName) { |
|
|
|
String collectionName) { |
|
|
|
return doUpdate(collectionName, query, update, entityClass, false, false); |
|
|
|
return doUpdate(collectionName, query, update, entityClass, false, false); |
|
|
|
@ -1800,6 +1853,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#updateMulti(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#updateMulti(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<UpdateResult> updateMulti(Query query, UpdateDefinition update, Class<?> entityClass) { |
|
|
|
public Mono<UpdateResult> updateMulti(Query query, UpdateDefinition update, Class<?> entityClass) { |
|
|
|
return doUpdate(getCollectionName(entityClass), query, update, entityClass, false, true); |
|
|
|
return doUpdate(getCollectionName(entityClass), query, update, entityClass, false, true); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1808,6 +1862,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#updateMulti(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#updateMulti(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<UpdateResult> updateMulti(Query query, UpdateDefinition update, String collectionName) { |
|
|
|
public Mono<UpdateResult> updateMulti(Query query, UpdateDefinition update, String collectionName) { |
|
|
|
return doUpdate(collectionName, query, update, null, false, true); |
|
|
|
return doUpdate(collectionName, query, update, null, false, true); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1816,6 +1871,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#updateMulti(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#updateMulti(org.springframework.data.mongodb.core.query.Query, org.springframework.data.mongodb.core.query.UpdateDefinition, java.lang.Class, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<UpdateResult> updateMulti(Query query, UpdateDefinition update, Class<?> entityClass, |
|
|
|
public Mono<UpdateResult> updateMulti(Query query, UpdateDefinition update, Class<?> entityClass, |
|
|
|
String collectionName) { |
|
|
|
String collectionName) { |
|
|
|
return doUpdate(collectionName, query, update, entityClass, false, true); |
|
|
|
return doUpdate(collectionName, query, update, entityClass, false, true); |
|
|
|
@ -1949,6 +2005,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#remove(java.lang.Object) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#remove(java.lang.Object) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<DeleteResult> remove(Object object) { |
|
|
|
public Mono<DeleteResult> remove(Object object) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(object, "Object must not be null!"); |
|
|
|
Assert.notNull(object, "Object must not be null!"); |
|
|
|
@ -1960,6 +2017,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#remove(java.lang.Object, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#remove(java.lang.Object, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<DeleteResult> remove(Object object, String collectionName) { |
|
|
|
public Mono<DeleteResult> remove(Object object, String collectionName) { |
|
|
|
|
|
|
|
|
|
|
|
Assert.notNull(object, "Object must not be null!"); |
|
|
|
Assert.notNull(object, "Object must not be null!"); |
|
|
|
@ -1993,6 +2051,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#remove(org.springframework.data.mongodb.core.query.Query, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#remove(org.springframework.data.mongodb.core.query.Query, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<DeleteResult> remove(Query query, String collectionName) { |
|
|
|
public Mono<DeleteResult> remove(Query query, String collectionName) { |
|
|
|
return remove(query, null, collectionName); |
|
|
|
return remove(query, null, collectionName); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -2001,6 +2060,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#remove(org.springframework.data.mongodb.core.query.Query, java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#remove(org.springframework.data.mongodb.core.query.Query, java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<DeleteResult> remove(Query query, Class<?> entityClass) { |
|
|
|
public Mono<DeleteResult> remove(Query query, Class<?> entityClass) { |
|
|
|
return remove(query, entityClass, getCollectionName(entityClass)); |
|
|
|
return remove(query, entityClass, getCollectionName(entityClass)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -2009,6 +2069,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#remove(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#remove(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<DeleteResult> remove(Query query, @Nullable Class<?> entityClass, String collectionName) { |
|
|
|
public Mono<DeleteResult> remove(Query query, @Nullable Class<?> entityClass, String collectionName) { |
|
|
|
return doRemove(collectionName, query, entityClass); |
|
|
|
return doRemove(collectionName, query, entityClass); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -2067,6 +2128,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAll(java.lang.Class) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAll(java.lang.Class) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Flux<T> findAll(Class<T> entityClass) { |
|
|
|
public <T> Flux<T> findAll(Class<T> entityClass) { |
|
|
|
return findAll(entityClass, getCollectionName(entityClass)); |
|
|
|
return findAll(entityClass, getCollectionName(entityClass)); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -2075,6 +2137,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAll(java.lang.Class, java.lang.String) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#findAll(java.lang.Class, java.lang.String) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Flux<T> findAll(Class<T> entityClass, String collectionName) { |
|
|
|
public <T> Flux<T> findAll(Class<T> entityClass, String collectionName) { |
|
|
|
return executeFindMultiInternal(new FindCallback(null), FindPublisherPreparer.NO_OP_PREPARER, |
|
|
|
return executeFindMultiInternal(new FindCallback(null), FindPublisherPreparer.NO_OP_PREPARER, |
|
|
|
new ReadDocumentCallback<>(mongoConverter, entityClass, collectionName), collectionName); |
|
|
|
new ReadDocumentCallback<>(mongoConverter, entityClass, collectionName), collectionName); |
|
|
|
@ -2194,6 +2257,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#mapReduce(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.Class, java.lang.String, java.lang.String, org.springframework.data.mongodb.core.mapreduce.MapReduceOptions) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#mapReduce(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.Class, java.lang.String, java.lang.String, org.springframework.data.mongodb.core.mapreduce.MapReduceOptions) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Flux<T> mapReduce(Query filterQuery, Class<?> domainType, Class<T> resultType, String mapFunction, |
|
|
|
public <T> Flux<T> mapReduce(Query filterQuery, Class<?> domainType, Class<T> resultType, String mapFunction, |
|
|
|
String reduceFunction, MapReduceOptions options) { |
|
|
|
String reduceFunction, MapReduceOptions options) { |
|
|
|
|
|
|
|
|
|
|
|
@ -2205,6 +2269,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
* (non-Javadoc) |
|
|
|
* (non-Javadoc) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#mapReduce(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String, java.lang.Class, java.lang.String, java.lang.String, org.springframework.data.mongodb.core.mapreduce.MapReduceOptions) |
|
|
|
* @see org.springframework.data.mongodb.core.ReactiveMongoOperations#mapReduce(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String, java.lang.Class, java.lang.String, java.lang.String, org.springframework.data.mongodb.core.mapreduce.MapReduceOptions) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
public <T> Flux<T> mapReduce(Query filterQuery, Class<?> domainType, String inputCollectionName, Class<T> resultType, |
|
|
|
public <T> Flux<T> mapReduce(Query filterQuery, Class<?> domainType, String inputCollectionName, Class<T> resultType, |
|
|
|
String mapFunction, String reduceFunction, MapReduceOptions options) { |
|
|
|
String mapFunction, String reduceFunction, MapReduceOptions options) { |
|
|
|
|
|
|
|
|
|
|
|
@ -3198,6 +3263,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
interface ReactiveCollectionQueryCallback<T> extends ReactiveCollectionCallback<T> { |
|
|
|
interface ReactiveCollectionQueryCallback<T> extends ReactiveCollectionCallback<T> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
FindPublisher<T> doInCollection(MongoCollection<Document> collection) throws MongoException, DataAccessException; |
|
|
|
FindPublisher<T> doInCollection(MongoCollection<Document> collection) throws MongoException, DataAccessException; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -3224,6 +3290,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
this.collectionName = collectionName; |
|
|
|
this.collectionName = collectionName; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<T> doWith(Document document) { |
|
|
|
public Mono<T> doWith(Document document) { |
|
|
|
|
|
|
|
|
|
|
|
maybeEmitEvent(new AfterLoadEvent<>(document, type, collectionName)); |
|
|
|
maybeEmitEvent(new AfterLoadEvent<>(document, type, collectionName)); |
|
|
|
@ -3261,6 +3328,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
this.collectionName = collectionName; |
|
|
|
this.collectionName = collectionName; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
public Mono<T> doWith(Document document) { |
|
|
|
public Mono<T> doWith(Document document) { |
|
|
|
|
|
|
|
|
|
|
|
@ -3310,6 +3378,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
this.metric = metric; |
|
|
|
this.metric = metric; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Mono<GeoResult<T>> doWith(Document object) { |
|
|
|
public Mono<GeoResult<T>> doWith(Document object) { |
|
|
|
|
|
|
|
|
|
|
|
double distance = getDistance(object); |
|
|
|
double distance = getDistance(object); |
|
|
|
@ -3341,6 +3410,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati |
|
|
|
this.type = type; |
|
|
|
this.type = type; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public FindPublisher<Document> prepare(FindPublisher<Document> findPublisher) { |
|
|
|
public FindPublisher<Document> prepare(FindPublisher<Document> findPublisher) { |
|
|
|
|
|
|
|
|
|
|
|
FindPublisher<Document> findPublisherToUse = operations.forType(type) //
|
|
|
|
FindPublisher<Document> findPublisherToUse = operations.forType(type) //
|
|
|
|
|