* TypedAggregation<T> geoNear = TypedAggregation.newAggregation(entityClass, Aggregation.geoNear(near, "dis"))
* .withOptions(AggregationOptions.builder().collation(near.getCollation()).build());
@@ -888,27 +889,12 @@ public interface MongoOperations extends FluentMongoOperations {
* @param entityClass the parametrized type. Must not be {@literal null}.
* @return the converted object that was updated before it was updated or {@literal null}, if not found.
* @since 2.3
+ * @see Update
+ * @see AggregationUpdate
*/
@Nullable
T findAndModify(Query query, UpdateDefinition update, Class entityClass);
- /**
- * Triggers findAndModify
- * to apply provided {@link Update} on documents matching {@link Criteria} of given {@link Query}.
- *
- * @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
- * fields specification. Must not be {@literal null}.
- * @param update the {@link Update} to apply on matching documents. Must not be {@literal null}.
- * @param entityClass the parametrized type. Must not be {@literal null}.
- * @return the converted object that was updated before it was updated or {@literal null}, if not found.
- * @deprecated since 2.3 in favor of {@link #findAndModify(Query, UpdateDefinition, Class)}.
- */
- @Deprecated
- @Nullable
- default T findAndModify(Query query, Update update, Class entityClass) {
- return findAndModify(query, (UpdateDefinition) update, entityClass);
- }
-
/**
* Triggers findAndModify
* to apply provided {@link Update} on documents matching {@link Criteria} of given {@link Query}.
@@ -920,28 +906,12 @@ public interface MongoOperations extends FluentMongoOperations {
* @param collectionName the collection to query. Must not be {@literal null}.
* @return the converted object that was updated before it was updated or {@literal null}, if not found.
* @since 2.3
+ * @see Update
+ * @see AggregationUpdate
*/
@Nullable
T findAndModify(Query query, UpdateDefinition update, Class entityClass, String collectionName);
- /**
- * Triggers findAndModify
- * to apply provided {@link Update} on documents matching {@link Criteria} of given {@link Query}.
- *
- * @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
- * fields specification. Must not be {@literal null}.
- * @param update the {@link Update} to apply on matching documents. Must not be {@literal null}.
- * @param entityClass the parametrized type. Must not be {@literal null}.
- * @param collectionName the collection to query. Must not be {@literal null}.
- * @return the converted object that was updated before it was updated or {@literal null}, if not found.
- * @deprecated since 2.3 in favor of {@link #findAndModify(Query, UpdateDefinition, Class, String)}.
- */
- @Deprecated
- @Nullable
- default T findAndModify(Query query, Update update, Class entityClass, String collectionName) {
- return findAndModify(query, (UpdateDefinition) update, entityClass, collectionName);
- }
-
/**
* Triggers findAndModify
* to apply provided {@link Update} on documents matching {@link Criteria} of given {@link Query} taking
@@ -956,31 +926,12 @@ public interface MongoOperations extends FluentMongoOperations {
* {@link FindAndModifyOptions#isReturnNew()} this will either be the object as it was before the update or as
* it is after the update.
* @since 2.3
+ * @see Update
+ * @see AggregationUpdate
*/
@Nullable
T findAndModify(Query query, UpdateDefinition update, FindAndModifyOptions options, Class entityClass);
- /**
- * Triggers findAndModify
- * to apply provided {@link Update} on documents matching {@link Criteria} of given {@link Query} taking
- * {@link FindAndModifyOptions} into account.
- *
- * @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
- * fields specification.
- * @param update the {@link Update} to apply on matching documents.
- * @param options the {@link FindAndModifyOptions} holding additional information.
- * @param entityClass the parametrized type.
- * @return the converted object that was updated or {@literal null}, if not found. Depending on the value of
- * {@link FindAndModifyOptions#isReturnNew()} this will either be the object as it was before the update or as
- * it is after the update.
- * @deprecated since 2.3 in favor of {@link #findAndModify(Query, UpdateDefinition, FindAndModifyOptions, Class)}
- */
- @Nullable
- @Deprecated
- default T findAndModify(Query query, Update update, FindAndModifyOptions options, Class entityClass) {
- return findAndModify(query, (UpdateDefinition) update, options, entityClass);
- }
-
/**
* Triggers findAndModify
* to apply provided {@link Update} on documents matching {@link Criteria} of given {@link Query} taking
@@ -996,35 +947,13 @@ public interface MongoOperations extends FluentMongoOperations {
* {@link FindAndModifyOptions#isReturnNew()} this will either be the object as it was before the update or as
* it is after the update.
* @since 2.3
+ * @see Update
+ * @see AggregationUpdate
*/
@Nullable
T findAndModify(Query query, UpdateDefinition update, FindAndModifyOptions options, Class entityClass,
String collectionName);
- /**
- * Triggers findAndModify
- * to apply provided {@link Update} on documents matching {@link Criteria} of given {@link Query} taking
- * {@link FindAndModifyOptions} into account.
- *
- * @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
- * fields specification. Must not be {@literal null}.
- * @param update the {@link Update} to apply on matching documents. Must not be {@literal null}.
- * @param options the {@link FindAndModifyOptions} holding additional information. Must not be {@literal null}.
- * @param entityClass the parametrized type. Must not be {@literal null}.
- * @param collectionName the collection to query. Must not be {@literal null}.
- * @return the converted object that was updated or {@literal null}, if not found. Depending on the value of
- * {@link FindAndModifyOptions#isReturnNew()} this will either be the object as it was before the update or as
- * it is after the update.
- * @deprecated since 2.3 in favor of
- * {@link #findAndModify(Query, UpdateDefinition, FindAndModifyOptions, Class, String)}.
- */
- @Deprecated
- @Nullable
- default T findAndModify(Query query, Update update, FindAndModifyOptions options, Class entityClass,
- String collectionName) {
- return findAndModify(query, (UpdateDefinition) update, options, entityClass, collectionName);
- }
-
/**
* Triggers
* findOneAndReplace
@@ -1371,313 +1300,165 @@ public interface MongoOperations extends FluentMongoOperations {
* Performs an upsert. If no document is found that matches the query, a new document is created and inserted by
* combining the query document and the update document.
* NOTE: {@link Query#getSortObject() sorting} is not supported by {@code db.collection.updateOne}.
- * Use {@link #findAndModify(Query, Update, FindAndModifyOptions, Class, String)} instead.
+ * Use {@link #findAndModify(Query, UpdateDefinition, FindAndModifyOptions, Class, String)} instead.
*
* @param query the query document that specifies the criteria used to select a record to be upserted. Must not be
* {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing
- * object. Must not be {@literal null}.
+ * @param update the {@link UpdateDefinition} that contains the updated object or {@code $} operators to manipulate
+ * the existing object. Must not be {@literal null}.
* @param entityClass class that determines the collection to use. Must not be {@literal null}.
* @return the {@link UpdateResult} which lets you access the results of the previous write.
* @since 2.3
+ * @see Update
+ * @see AggregationUpdate
*/
UpdateResult upsert(Query query, UpdateDefinition update, Class> entityClass);
- /**
- * Performs an upsert. If no document is found that matches the query, a new document is created and inserted by
- * combining the query document and the update document.
- *
- * @param query the query document that specifies the criteria used to select a record to be upserted. Must not be
- * {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing
- * object. Must not be {@literal null}.
- * @param entityClass class that determines the collection to use. Must not be {@literal null}.
- * @return the {@link UpdateResult} which lets you access the results of the previous write.
- * @deprecated since 2.3 in favor of {@link #upsert(Query, UpdateDefinition, Class)}
- */
- @Deprecated
- default UpdateResult upsert(Query query, Update update, Class> entityClass) {
- return upsert(query, (UpdateDefinition) update, entityClass);
- }
-
/**
* Performs an upsert. If no document is found that matches the query, a new document is created and inserted by
* combining the query document and the update document.
* NOTE: Any additional support for field mapping, versions, etc. is not available due to the lack of
- * domain type information. Use {@link #upsert(Query, Update, Class, String)} to get full type specific support.
- *
+ * domain type information. Use {@link #upsert(Query, UpdateDefinition, Class, String)} to get full type specific
+ * support.
* NOTE: {@link Query#getSortObject() sorting} is not supported by {@code db.collection.updateOne}.
- * Use {@link #findAndModify(Query, Update, FindAndModifyOptions, Class, String)} instead.
+ * Use {@link #findAndModify(Query, UpdateDefinition, FindAndModifyOptions, Class, String)} instead.
*
* @param query the query document that specifies the criteria used to select a record to be upserted. Must not be
* {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing
- * object. Must not be {@literal null}.
+ * @param update the {@link UpdateDefinition} that contains the updated object or {@code $} operators to manipulate
+ * the existing object. Must not be {@literal null}.
* @param collectionName name of the collection to update the object in.
* @return the {@link UpdateResult} which lets you access the results of the previous write.
* @since 2.3
+ * @see Update
+ * @see AggregationUpdate
*/
UpdateResult upsert(Query query, UpdateDefinition update, String collectionName);
- /**
- * Performs an upsert. If no document is found that matches the query, a new document is created and inserted by
- * combining the query document and the update document.
- * NOTE: Any additional support for field mapping, versions, etc. is not available due to the lack of
- * domain type information. Use {@link #upsert(Query, Update, Class, String)} to get full type specific support.
- *
- * @param query the query document that specifies the criteria used to select a record to be upserted. Must not be
- * {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing
- * object. Must not be {@literal null}.
- * @param collectionName name of the collection to update the object in.
- * @return the {@link UpdateResult} which lets you access the results of the previous write.
- * @deprecated since 2.3 in favor of {@link #upsert(Query, UpdateDefinition, String)}
- */
- @Deprecated
- default UpdateResult upsert(Query query, Update update, String collectionName) {
- return upsert(query, (UpdateDefinition) update, collectionName);
- }
-
/**
* Performs an upsert. If no document is found that matches the query, a new document is created and inserted by
* combining the query document and the update document.
*
* @param query the query document that specifies the criteria used to select a record to be upserted. Must not be
* {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing
- * object. Must not be {@literal null}.
+ * @param update the {@link UpdateDefinition} that contains the updated object or {@code $} operators to manipulate
+ * the existing object. Must not be {@literal null}.
* @param entityClass class of the pojo to be operated on. Must not be {@literal null}.
* @param collectionName name of the collection to update the object in. Must not be {@literal null}.
* @return the {@link UpdateResult} which lets you access the results of the previous write.
* @since 2.3
+ * @see Update
+ * @see AggregationUpdate
*/
UpdateResult upsert(Query query, UpdateDefinition update, Class> entityClass, String collectionName);
- /**
- * Performs an upsert. If no document is found that matches the query, a new document is created and inserted by
- * combining the query document and the update document.
- * NOTE: {@link Query#getSortObject() sorting} is not supported by {@code db.collection.updateOne}.
- * Use {@link #findAndModify(Query, Update, FindAndModifyOptions, Class, String)} instead.
- *
- * @param query the query document that specifies the criteria used to select a record to be upserted. Must not be
- * {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing
- * object. Must not be {@literal null}.
- * @param entityClass class of the pojo to be operated on. Must not be {@literal null}.
- * @param collectionName name of the collection to update the object in. Must not be {@literal null}.
- * @return the {@link UpdateResult} which lets you access the results of the previous write.
- * @deprecated since 2.3 in favor of {@link #upsert(Query, UpdateDefinition, Class, String)}
- */
- @Deprecated
- default UpdateResult upsert(Query query, Update update, Class> entityClass, String collectionName) {
- return upsert(query, (UpdateDefinition) update, entityClass, collectionName);
- }
-
/**
* Updates the first object that is found in the collection of the entity class that matches the query document with
* the provided update document.
*
* @param query the query document that specifies the criteria used to select a record to be updated. Must not be
* {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing. Must
- * not be {@literal null}.
+ * @param update the {@link UpdateDefinition} that contains the updated object or {@code $} operators to manipulate
+ * the existing. Must not be {@literal null}.
* @param entityClass class that determines the collection to use.
* @return the {@link UpdateResult} which lets you access the results of the previous write.
* @since 2.3
+ * @see Update
+ * @see AggregationUpdate
*/
UpdateResult updateFirst(Query query, UpdateDefinition update, Class> entityClass);
- /**
- * Updates the first object that is found in the collection of the entity class that matches the query document with
- * the provided update document.
- * NOTE: {@link Query#getSortObject() sorting} is not supported by {@code db.collection.updateOne}.
- * Use {@link #findAndModify(Query, Update, Class)} instead.
- *
- * @param query the query document that specifies the criteria used to select a record to be updated. Must not be
- * {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing. Must
- * not be {@literal null}.
- * @param entityClass class that determines the collection to use.
- * @return the {@link UpdateResult} which lets you access the results of the previous write.
- * @deprecated since 2.3 in favor of {@link #updateFirst(Query, UpdateDefinition, Class)}.
- */
- @Deprecated
- default UpdateResult updateFirst(Query query, Update update, Class> entityClass) {
- return updateFirst(query, (UpdateDefinition) update, entityClass);
- }
-
/**
* Updates the first object that is found in the specified collection that matches the query document criteria with
* the provided updated document.
* NOTE: Any additional support for field mapping, versions, etc. is not available due to the lack of
- * domain type information. Use {@link #updateFirst(Query, Update, Class, String)} to get full type specific support.
+ * domain type information. Use {@link #updateFirst(Query, UpdateDefinition, Class, String)} to get full type specific
+ * support.
*
* NOTE: {@link Query#getSortObject() sorting} is not supported by {@code db.collection.updateOne}.
* Use {@link #findAndModify(Query, Update, Class, String)} instead.
*
* @param query the query document that specifies the criteria used to select a record to be updated. Must not be
* {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing. Must
- * not be {@literal null}.
+ * @param update the {@link UpdateDefinition} that contains the updated object or {@code $} operators to manipulate
+ * the existing. Must not be {@literal null}.
* @param collectionName name of the collection to update the object in. Must not be {@literal null}.
* @return the {@link UpdateResult} which lets you access the results of the previous write.
* @since 2.3
+ * @see Update
+ * @see AggregationUpdate
*/
UpdateResult updateFirst(Query query, UpdateDefinition update, String collectionName);
/**
* Updates the first object that is found in the specified collection that matches the query document criteria with
* the provided updated document.
- * NOTE: Any additional support for field mapping, versions, etc. is not available due to the lack of
- * domain type information. Use {@link #updateFirst(Query, Update, Class, String)} to get full type specific support.
*
* @param query the query document that specifies the criteria used to select a record to be updated. Must not be
* {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing. Must
- * not be {@literal null}.
- * @param collectionName name of the collection to update the object in. Must not be {@literal null}.
- * @return the {@link UpdateResult} which lets you access the results of the previous write.
- * @deprecated since 2.3 in favor of {@link #updateFirst(Query, UpdateDefinition, String)}.
- */
- @Deprecated
- default UpdateResult updateFirst(Query query, Update update, String collectionName) {
- return updateFirst(query, (UpdateDefinition) update, collectionName);
- }
-
- /**
- * Updates the first object that is found in the specified collection that matches the query document criteria with
- * the provided updated document.
- *
- * @param query the query document that specifies the criteria used to select a record to be updated. Must not be
- * {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing. Must
- * not be {@literal null}.
+ * @param update the {@link UpdateDefinition} that contains the updated object or {@code $} operators to manipulate
+ * the existing. Must not be {@literal null}.
* @param entityClass class of the pojo to be operated on. Must not be {@literal null}.
* @param collectionName name of the collection to update the object in. Must not be {@literal null}.
* @return the {@link UpdateResult} which lets you access the results of the previous write.
* @since 2.3
+ * @see Update
+ * @see AggregationUpdate
*/
UpdateResult updateFirst(Query query, UpdateDefinition update, Class> entityClass, String collectionName);
- /**
- * Updates the first object that is found in the specified collection that matches the query document criteria with
- * the provided updated document.
- * NOTE: {@link Query#getSortObject() sorting} is not supported by {@code db.collection.updateOne}.
- * Use {@link #findAndModify(Query, Update, Class, String)} instead.
- *
- * @param query the query document that specifies the criteria used to select a record to be updated. Must not be
- * {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing. Must
- * not be {@literal null}.
- * @param entityClass class of the pojo to be operated on. Must not be {@literal null}.
- * @param collectionName name of the collection to update the object in. Must not be {@literal null}.
- * @return the {@link UpdateResult} which lets you access the results of the previous write.
- * @deprecated since 2.3 in favor of {@link #updateFirst(Query, UpdateDefinition, Class, String)}.
- */
- @Deprecated
- default UpdateResult updateFirst(Query query, Update update, Class> entityClass, String collectionName) {
- return updateFirst(query, (UpdateDefinition) update, entityClass, collectionName);
- }
-
/**
* Updates all objects that are found in the collection for the entity class that matches the query document criteria
* with the provided updated document.
*
* @param query the query document that specifies the criteria used to select a record to be updated. Must not be
* {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing. Must
- * not be {@literal null}.
+ * @param update the {@link UpdateDefinition} that contains the updated object or {@code $} operators to manipulate
+ * the existing. Must not be {@literal null}.
* @param entityClass class of the pojo to be operated on. Must not be {@literal null}.
* @return the {@link UpdateResult} which lets you access the results of the previous write.
* @since 2.3
+ * @see Update
+ * @see AggregationUpdate
*/
UpdateResult updateMulti(Query query, UpdateDefinition update, Class> entityClass);
- /**
- * Updates all objects that are found in the collection for the entity class that matches the query document criteria
- * with the provided updated document.
- *
- * @param query the query document that specifies the criteria used to select a record to be updated. Must not be
- * {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing. Must
- * not be {@literal null}.
- * @param entityClass class of the pojo to be operated on. Must not be {@literal null}.
- * @return the {@link UpdateResult} which lets you access the results of the previous write.
- * @deprecated since 2.3 in favor of {@link #updateMulti(Query, UpdateDefinition, Class)}.
- */
- @Deprecated
- default UpdateResult updateMulti(Query query, Update update, Class> entityClass) {
- return updateMulti(query, (UpdateDefinition) update, entityClass);
- }
-
/**
* Updates all objects that are found in the specified collection that matches the query document criteria with the
* provided updated document.
* NOTE: Any additional support for field mapping, versions, etc. is not available due to the lack of
- * domain type information. Use {@link #updateMulti(Query, Update, Class, String)} to get full type specific support.
+ * domain type information. Use {@link #updateMulti(Query, UpdateDefinition, Class, String)} to get full type specific
+ * support.
*
* @param query the query document that specifies the criteria used to select a record to be updated. Must not be
* {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing. Must
- * not be {@literal null}.
+ * @param update the {@link UpdateDefinition} that contains the updated object or {@code $} operators to manipulate
+ * the existing. Must not be {@literal null}.
* @param collectionName name of the collection to update the object in. Must not be {@literal null}.
* @return the {@link UpdateResult} which lets you access the results of the previous write.
* @since 2.3
+ * @see Update
+ * @see AggregationUpdate
*/
UpdateResult updateMulti(Query query, UpdateDefinition update, String collectionName);
- /**
- * Updates all objects that are found in the specified collection that matches the query document criteria with the
- * provided updated document.
- * NOTE: Any additional support for field mapping, versions, etc. is not available due to the lack of
- * domain type information. Use {@link #updateMulti(Query, Update, Class, String)} to get full type specific support.
- *
- * @param query the query document that specifies the criteria used to select a record to be updated. Must not be
- * {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing. Must
- * not be {@literal null}.
- * @param collectionName name of the collection to update the object in. Must not be {@literal null}.
- * @return the {@link UpdateResult} which lets you access the results of the previous write.
- * @deprecated since 2.3 in favor of {@link #updateMulti(Query, UpdateDefinition, String)}.
- */
- @Deprecated
- default UpdateResult updateMulti(Query query, Update update, String collectionName) {
- return updateMulti(query, (UpdateDefinition) update, collectionName);
- }
-
/**
* Updates all objects that are found in the collection for the entity class that matches the query document criteria
* with the provided updated document.
*
* @param query the query document that specifies the criteria used to select a record to be updated. Must not be
* {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing. Must
- * not be {@literal null}.
+ * @param update the {@link UpdateDefinition} that contains the updated object or {@code $} operators to manipulate
+ * the existing. Must not be {@literal null}.
* @param entityClass class of the pojo to be operated on. Must not be {@literal null}.
* @param collectionName name of the collection to update the object in. Must not be {@literal null}.
* @return the {@link UpdateResult} which lets you access the results of the previous write.
* @since 2.3
+ * @see Update
+ * @see AggregationUpdate
*/
UpdateResult updateMulti(Query query, UpdateDefinition update, Class> entityClass, String collectionName);
- /**
- * Updates all objects that are found in the collection for the entity class that matches the query document criteria
- * with the provided updated document.
- *
- * @param query the query document that specifies the criteria used to select a record to be updated. Must not be
- * {@literal null}.
- * @param update the update document that contains the updated object or $ operators to manipulate the existing. Must
- * not be {@literal null}.
- * @param entityClass class of the pojo to be operated on. Must not be {@literal null}.
- * @param collectionName name of the collection to update the object in. Must not be {@literal null}.
- * @return the {@link UpdateResult} which lets you access the results of the previous write.
- * @deprecated since 2.3 in favor of {@link #updateMulti(Query, UpdateDefinition, Class, String)}.
- */
- @Deprecated
- default UpdateResult updateMulti(Query query, Update update, Class> entityClass, String collectionName) {
- return updateMulti(query, (UpdateDefinition) update, entityClass, collectionName);
- }
-
/**
* Remove the given object from the collection by {@literal id} and (if applicable) its
* {@link org.springframework.data.annotation.Version}.
diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java
index a2f2a804e..819426236 100644
--- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java
+++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java
@@ -437,7 +437,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
}
@SuppressWarnings("ConstantConditions")
- protected CloseableIterator doStream(Query query, final Class> entityType, String collectionName,
+ protected CloseableIterator doStream(Query query, Class> entityType, String collectionName,
Class returnType) {
Assert.notNull(query, "Query must not be null!");
@@ -471,7 +471,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
*/
@Override
@SuppressWarnings("ConstantConditions")
- public Document executeCommand(final String jsonCommand) {
+ public Document executeCommand(String jsonCommand) {
Assert.hasText(jsonCommand, "JsonCommand must not be null nor empty!");
@@ -484,7 +484,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
*/
@Override
@SuppressWarnings("ConstantConditions")
- public Document executeCommand(final Document command) {
+ public Document executeCommand(Document command) {
Assert.notNull(command, "Command must not be null!");
@@ -655,7 +655,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
* (non-Javadoc)
* @see org.springframework.data.mongodb.core.MongoOperations#createCollection(java.lang.String)
*/
- public MongoCollection createCollection(final String collectionName) {
+ public MongoCollection createCollection(String collectionName) {
Assert.notNull(collectionName, "CollectionName must not be null!");
@@ -666,8 +666,8 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
* (non-Javadoc)
* @see org.springframework.data.mongodb.core.MongoOperations#createCollection(java.lang.String, org.springframework.data.mongodb.core.CollectionOptions)
*/
- public MongoCollection createCollection(final String collectionName,
- final @Nullable CollectionOptions collectionOptions) {
+ public MongoCollection createCollection(String collectionName,
+ @Nullable CollectionOptions collectionOptions) {
Assert.notNull(collectionName, "CollectionName must not be null!");
return doCreateCollection(collectionName, convertToDocument(collectionOptions));
@@ -678,7 +678,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
* @see org.springframework.data.mongodb.core.MongoOperations#getCollection(java.lang.String)
*/
@SuppressWarnings("ConstantConditions")
- public MongoCollection getCollection(final String collectionName) {
+ public MongoCollection getCollection(String collectionName) {
Assert.notNull(collectionName, "CollectionName must not be null!");
@@ -698,7 +698,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
* @see org.springframework.data.mongodb.core.ExecutableInsertOperation#getCollection(java.lang.String)
*/
@SuppressWarnings("ConstantConditions")
- public boolean collectionExists(final String collectionName) {
+ public boolean collectionExists(String collectionName) {
Assert.notNull(collectionName, "CollectionName must not be null!");
@@ -729,15 +729,13 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
Assert.notNull(collectionName, "CollectionName must not be null!");
- execute(collectionName, new CollectionCallback() {
- public Void doInCollection(MongoCollection collection) throws MongoException, DataAccessException {
- collection.drop();
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Dropped collection [{}]",
- collection.getNamespace() != null ? collection.getNamespace().getCollectionName() : collectionName);
- }
- return null;
+ execute(collectionName, (CollectionCallback) collection -> {
+ collection.drop();
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Dropped collection [{}]",
+ collection.getNamespace() != null ? collection.getNamespace().getCollectionName() : collectionName);
}
+ return null;
});
}
@@ -1154,7 +1152,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
}
@Override
- public long count(final Query query, String collectionName) {
+ public long count(Query query, String collectionName) {
return count(query, null, collectionName);
}
@@ -1484,7 +1482,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
}
@SuppressWarnings("ConstantConditions")
- protected Object insertDocument(final String collectionName, final Document document, final Class> entityClass) {
+ protected Object insertDocument(String collectionName, Document document, Class> entityClass) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Inserting Document containing fields: {} in collection: {}", document.keySet(), collectionName);
@@ -1505,7 +1503,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
});
}
- protected List