Polishing.
Consistently use Document instead of record. Reformat code. Tweak documentation wording. See: #4462
This commit is contained in:
committed by
Christoph Strobl
parent
49ff6f1e48
commit
501a1cce39
@@ -89,8 +89,7 @@ public interface ExecutableUpdateOperation {
|
||||
|
||||
/**
|
||||
* Trigger <a href="https://docs.mongodb.com/manual/reference/method/db.collection.replaceOne/">replaceOne</a>
|
||||
* execution by calling one of the terminating methods./** Trigger replace execution by calling one of the terminating
|
||||
* methods.
|
||||
* execution by calling one of the terminating methods.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @since 4.2
|
||||
@@ -99,7 +98,7 @@ public interface ExecutableUpdateOperation {
|
||||
|
||||
/**
|
||||
* Find first and replace/upsert.
|
||||
*
|
||||
*
|
||||
* @return never {@literal null}.
|
||||
*/
|
||||
UpdateResult replaceFirst();
|
||||
|
||||
@@ -130,7 +130,7 @@ class ExecutableUpdateOperationSupport implements ExecutableUpdateOperation {
|
||||
public TerminatingReplace withOptions(ReplaceOptions options) {
|
||||
|
||||
FindAndReplaceOptions target = new FindAndReplaceOptions();
|
||||
if(options.isUpsert()) {
|
||||
if (options.isUpsert()) {
|
||||
target.upsert();
|
||||
}
|
||||
return new ExecutableUpdateSupport<>(template, domainType, query, update, collection, findAndModifyOptions,
|
||||
@@ -188,11 +188,13 @@ class ExecutableUpdateOperationSupport implements ExecutableUpdateOperation {
|
||||
|
||||
@Override
|
||||
public UpdateResult replaceFirst() {
|
||||
if(replacement != null) {
|
||||
return template.replace(query, domainType, replacement, findAndReplaceOptions != null ? findAndReplaceOptions : ReplaceOptions.none(), getCollectionName());
|
||||
if (replacement != null) {
|
||||
return template.replace(query, domainType, replacement,
|
||||
findAndReplaceOptions != null ? findAndReplaceOptions : ReplaceOptions.none(), getCollectionName());
|
||||
}
|
||||
|
||||
return template.replace(query, domainType, update, findAndReplaceOptions != null ? findAndReplaceOptions : ReplaceOptions.none(), getCollectionName());
|
||||
return template.replace(query, domainType, update,
|
||||
findAndReplaceOptions != null ? findAndReplaceOptions : ReplaceOptions.none(), getCollectionName());
|
||||
}
|
||||
|
||||
private UpdateResult doUpdate(boolean multi, boolean upsert) {
|
||||
|
||||
@@ -119,7 +119,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
/**
|
||||
* Execute a MongoDB query and iterate over the query results on a per-document basis with a DocumentCallbackHandler.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification. Must not be {@literal null}.
|
||||
* @param collectionName name of the collection to retrieve the objects from.
|
||||
* @param dch the handler that will extract results, one document at a time.
|
||||
@@ -225,7 +225,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* <p>
|
||||
* Returns a {@link String} that wraps the Mongo DB {@link com.mongodb.client.FindIterable} that needs to be closed.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification. Must not be {@literal null}.
|
||||
* @param entityType must not be {@literal null}.
|
||||
* @param <T> element return type
|
||||
@@ -241,7 +241,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* <p>
|
||||
* Returns a {@link Stream} that wraps the Mongo DB {@link com.mongodb.client.FindIterable} that needs to be closed.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification. Must not be {@literal null}.
|
||||
* @param entityType must not be {@literal null}.
|
||||
* @param collectionName must not be {@literal null} or empty.
|
||||
@@ -723,7 +723,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* The query is specified as a {@link Query} which can be created either using the {@link BasicQuery} or the more
|
||||
* feature rich {@link Query}.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification.
|
||||
* @param entityClass the parametrized type of the returned list.
|
||||
* @return the converted object.
|
||||
@@ -739,7 +739,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* The query is specified as a {@link Query} which can be created either using the {@link BasicQuery} or the more
|
||||
* feature rich {@link Query}.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification.
|
||||
* @param entityClass the parametrized type of the returned list.
|
||||
* @param collectionName name of the collection to retrieve the objects from.
|
||||
@@ -753,7 +753,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* <strong>NOTE:</strong> Any additional support for query/field mapping, etc. is not available due to the lack of
|
||||
* domain type information. Use {@link #exists(Query, Class, String)} to get full type specific support.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the criteria used to find a record.
|
||||
* @param query the {@link Query} class that specifies the criteria used to find a document.
|
||||
* @param collectionName name of the collection to check for objects.
|
||||
* @return {@literal true} if the query yields a result.
|
||||
*/
|
||||
@@ -762,7 +762,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
/**
|
||||
* Determine result of given {@link Query} contains at least one element.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the criteria used to find a record.
|
||||
* @param query the {@link Query} class that specifies the criteria used to find a document.
|
||||
* @param entityClass the parametrized type.
|
||||
* @return {@literal true} if the query yields a result.
|
||||
*/
|
||||
@@ -771,7 +771,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
/**
|
||||
* Determine result of given {@link Query} contains at least one element.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the criteria used to find a record.
|
||||
* @param query the {@link Query} class that specifies the criteria used to find a document.
|
||||
* @param entityClass the parametrized type. Can be {@literal null}.
|
||||
* @param collectionName name of the collection to check for objects.
|
||||
* @return {@literal true} if the query yields a result.
|
||||
@@ -785,7 +785,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* The query is specified as a {@link Query} which can be created either using the {@link BasicQuery} or the more
|
||||
* feature rich {@link Query}.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification. Must not be {@literal null}.
|
||||
* @param entityClass the parametrized type of the returned list. Must not be {@literal null}.
|
||||
* @return the List of converted objects.
|
||||
@@ -799,7 +799,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* The query is specified as a {@link Query} which can be created either using the {@link BasicQuery} or the more
|
||||
* feature rich {@link Query}.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification. Must not be {@literal null}.
|
||||
* @param entityClass the parametrized type of the returned list. Must not be {@literal null}.
|
||||
* @param collectionName name of the collection to retrieve the objects from. Must not be {@literal null}.
|
||||
@@ -820,7 +820,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* sort properties} as MongoDB does not support criteria to reconstruct a query result from absent document fields or
|
||||
* {@code null} values through {@code $gt/$lt} operators.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification. Must not be {@literal null}.
|
||||
* @param entityType the parametrized type of the returned window.
|
||||
* @return the converted window.
|
||||
@@ -845,7 +845,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* sort properties} as MongoDB does not support criteria to reconstruct a query result from absent document fields or
|
||||
* {@code null} values through {@code $gt/$lt} operators.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification. Must not be {@literal null}.
|
||||
* @param entityType the parametrized type of the returned window.
|
||||
* @param collectionName name of the collection to retrieve the objects from.
|
||||
@@ -943,7 +943,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* Triggers <a href="https://docs.mongodb.org/manual/reference/method/db.collection.findAndModify/">findAndModify </a>
|
||||
* 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
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param update the {@link UpdateDefinition} to apply on matching documents. Must not be {@literal null}.
|
||||
* @param entityClass the parametrized type. Must not be {@literal null}.
|
||||
@@ -959,7 +959,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* Triggers <a href="https://docs.mongodb.org/manual/reference/method/db.collection.findAndModify/">findAndModify </a>
|
||||
* 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
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param update the {@link UpdateDefinition} to apply on matching documents. Must not be {@literal null}.
|
||||
* @param entityClass the parametrized type. Must not be {@literal null}.
|
||||
@@ -977,7 +977,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* 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
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification.
|
||||
* @param update the {@link UpdateDefinition} to apply on matching documents.
|
||||
* @param options the {@link FindAndModifyOptions} holding additional information.
|
||||
@@ -997,7 +997,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* 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
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param update the {@link UpdateDefinition} to apply on matching documents. Must not be {@literal null}.
|
||||
* @param options the {@link FindAndModifyOptions} holding additional information. Must not be {@literal null}.
|
||||
@@ -1023,7 +1023,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* Options are defaulted to {@link FindAndReplaceOptions#empty()}. <br />
|
||||
* <strong>NOTE:</strong> The replacement entity must not hold an {@literal id}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
* @return the converted object that was updated or {@literal null}, if not found.
|
||||
@@ -1044,7 +1044,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* Options are defaulted to {@link FindAndReplaceOptions#empty()}. <br />
|
||||
* <strong>NOTE:</strong> The replacement entity must not hold an {@literal id}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
* @param collectionName the collection to query. Must not be {@literal null}.
|
||||
@@ -1063,7 +1063,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* taking {@link FindAndReplaceOptions} into account.<br />
|
||||
* <strong>NOTE:</strong> The replacement entity must not hold an {@literal id}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
* @param options the {@link FindAndModifyOptions} holding additional information. Must not be {@literal null}.
|
||||
@@ -1086,7 +1086,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* taking {@link FindAndReplaceOptions} into account.<br />
|
||||
* <strong>NOTE:</strong> The replacement entity must not hold an {@literal id}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
* @param options the {@link FindAndModifyOptions} holding additional information. Must not be {@literal null}.
|
||||
@@ -1109,7 +1109,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* taking {@link FindAndReplaceOptions} into account.<br />
|
||||
* <strong>NOTE:</strong> The replacement entity must not hold an {@literal id}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
* @param options the {@link FindAndModifyOptions} holding additional information. Must not be {@literal null}.
|
||||
@@ -1134,7 +1134,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* taking {@link FindAndReplaceOptions} into account.<br />
|
||||
* <strong>NOTE:</strong> The replacement entity must not hold an {@literal id}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
* @param options the {@link FindAndModifyOptions} holding additional information. Must not be {@literal null}.
|
||||
@@ -1164,7 +1164,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* taking {@link FindAndReplaceOptions} into account.<br />
|
||||
* <strong>NOTE:</strong> The replacement entity must not hold an {@literal id}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
* @param options the {@link FindAndModifyOptions} holding additional information. Must not be {@literal null}.
|
||||
@@ -1189,7 +1189,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* The query is specified as a {@link Query} which can be created either using the {@link BasicQuery} or the more
|
||||
* feature rich {@link Query}.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification.
|
||||
* @param entityClass the parametrized type of the returned list.
|
||||
* @return the converted object
|
||||
@@ -1206,7 +1206,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* The query is specified as a {@link Query} which can be created either using the {@link BasicQuery} or the more
|
||||
* feature rich {@link Query}.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification.
|
||||
* @param entityClass the parametrized type of the returned list.
|
||||
* @param collectionName name of the collection to retrieve the objects from.
|
||||
@@ -1491,7 +1491,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* <strong>NOTE:</strong> {@link Query#getSortObject() sorting} is not supported by {@code db.collection.updateOne}.
|
||||
* 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
|
||||
* @param query the query document that specifies the criteria used to select a document to be upserted. 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}.
|
||||
@@ -1514,7 +1514,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* <strong>NOTE:</strong> {@link Query#getSortObject() sorting} is not supported by {@code db.collection.updateOne}.
|
||||
* 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
|
||||
* @param query the query document that specifies the criteria used to select a document to be upserted. 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}.
|
||||
@@ -1530,7 +1530,7 @@ 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.
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to select a record to be upserted. Must not be
|
||||
* @param query the query document that specifies the criteria used to select a document to be upserted. 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}.
|
||||
@@ -1547,7 +1547,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* 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
|
||||
* @param query the query document that specifies the criteria used to select a document to be updated. 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}.
|
||||
@@ -1570,7 +1570,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* <strong>NOTE:</strong> {@link Query#getSortObject() sorting} is not supported by {@code db.collection.updateOne}.
|
||||
* Use {@link #findAndModify(Query, UpdateDefinition, Class, String)} instead.
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to select a record to be updated. Must not be
|
||||
* @param query the query document that specifies the criteria used to select a document to be updated. 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}.
|
||||
@@ -1586,7 +1586,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* Updates the first object that is found in the specified collection that matches the query document criteria with
|
||||
* the provided updated document. <br />
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to select a record to be updated. Must not be
|
||||
* @param query the query document that specifies the criteria used to select a document to be updated. 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}.
|
||||
@@ -1603,7 +1603,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* 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
|
||||
* @param query the query document that specifies the criteria used to select a document to be updated. 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}.
|
||||
@@ -1624,7 +1624,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* 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
|
||||
* @param query the query document that specifies the criteria used to select a document to be updated. 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}.
|
||||
@@ -1640,7 +1640,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* 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
|
||||
* @param query the query document that specifies the criteria used to select a document to be updated. 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}.
|
||||
@@ -1673,7 +1673,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* acknowledged} remove operation was successful or not.
|
||||
*
|
||||
* @param object must not be {@literal null}.
|
||||
* @param collectionName name of the collection where the objects will removed, must not be {@literal null} or empty.
|
||||
* @param collectionName name of the collection where the documents will be removed from, must not be {@literal null} or empty.
|
||||
* @return the {@link DeleteResult} which lets you access the results of the previous delete.
|
||||
*/
|
||||
DeleteResult remove(Object object, String collectionName);
|
||||
@@ -1682,7 +1682,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* Remove all documents that match the provided query document criteria from the collection used to store the
|
||||
* entityClass. The Class parameter is also used to help convert the Id of the object if it is present in the query.
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to remove a record.
|
||||
* @param query the query document that specifies the criteria used to remove a document.
|
||||
* @param entityClass class that determines the collection to use.
|
||||
* @return the {@link DeleteResult} which lets you access the results of the previous delete.
|
||||
* @throws IllegalArgumentException when {@literal query} or {@literal entityClass} is {@literal null}.
|
||||
@@ -1695,9 +1695,9 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* Remove all documents that match the provided query document criteria from the collection used to store the
|
||||
* entityClass. The Class parameter is also used to help convert the Id of the object if it is present in the query.
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to remove a record.
|
||||
* @param query the query document that specifies the criteria used to remove a document.
|
||||
* @param entityClass class of the pojo to be operated on. Can be {@literal null}.
|
||||
* @param collectionName name of the collection where the objects will removed, must not be {@literal null} or empty.
|
||||
* @param collectionName name of the collection where the documents will be removed from, must not be {@literal null} or empty.
|
||||
* @return the {@link DeleteResult} which lets you access the results of the previous delete.
|
||||
* @throws IllegalArgumentException when {@literal query}, {@literal entityClass} or {@literal collectionName} is
|
||||
* {@literal null}.
|
||||
@@ -1710,8 +1710,8 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* <strong>NOTE:</strong> Any additional support for field mapping is not available due to the lack of domain type
|
||||
* information. Use {@link #remove(Query, Class, String)} to get full type specific support.
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to remove a record.
|
||||
* @param collectionName name of the collection where the objects will removed, must not be {@literal null} or empty.
|
||||
* @param query the query document that specifies the criteria used to remove a document.
|
||||
* @param collectionName name of the collection where the documents will be removed from, must not be {@literal null} or empty.
|
||||
* @return the {@link DeleteResult} which lets you access the results of the previous delete.
|
||||
* @throws IllegalArgumentException when {@literal query} or {@literal collectionName} is {@literal null}.
|
||||
*/
|
||||
@@ -1723,7 +1723,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* information. Use {@link #findAllAndRemove(Query, Class, String)} to get full type specific support.
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to find and remove documents.
|
||||
* @param collectionName name of the collection where the objects will removed, must not be {@literal null} or empty.
|
||||
* @param collectionName name of the collection where the documents will be removed from, must not be {@literal null} or empty.
|
||||
* @return the {@link List} converted objects deleted by this operation.
|
||||
* @since 1.5
|
||||
*/
|
||||
@@ -1748,7 +1748,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to find and remove documents.
|
||||
* @param entityClass class of the pojo to be operated on.
|
||||
* @param collectionName name of the collection where the objects will removed, must not be {@literal null} or empty.
|
||||
* @param collectionName name of the collection where the documents will be removed from, must not be {@literal null} or empty.
|
||||
* @return the {@link List} converted objects deleted by this operation.
|
||||
* @since 1.5
|
||||
*/
|
||||
@@ -1760,7 +1760,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* The collection name is derived from the {@literal replacement} type. <br />
|
||||
* Options are defaulted to {@link ReplaceOptions#none()}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record. The query may
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document. The query may
|
||||
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
|
||||
* to use. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
@@ -1777,7 +1777,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* Replace a single document matching the {@link Criteria} of given {@link Query} with the {@code replacement}
|
||||
* document. Options are defaulted to {@link ReplaceOptions#none()}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record. The query may
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document. The query may
|
||||
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
|
||||
* to use. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
@@ -1795,7 +1795,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* Replace a single document matching the {@link Criteria} of given {@link Query} with the {@code replacement}
|
||||
* document taking {@link ReplaceOptions} into account.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record.The query may
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document.The query may
|
||||
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
|
||||
* to use. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
@@ -1813,7 +1813,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* Replace a single document matching the {@link Criteria} of given {@link Query} with the {@code replacement}
|
||||
* document taking {@link ReplaceOptions} into account.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record. The query may *
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document. The query may *
|
||||
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
|
||||
* to use. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
@@ -1833,7 +1833,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* Replace a single document matching the {@link Criteria} of given {@link Query} with the {@code replacement}
|
||||
* document taking {@link ReplaceOptions} into account.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record. The query may
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document. The query may
|
||||
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
|
||||
* to use. Must not be {@literal null}.
|
||||
* @param entityType the type used for mapping the {@link Query} to domain type fields and deriving the collection
|
||||
@@ -1853,7 +1853,7 @@ public interface MongoOperations extends FluentMongoOperations {
|
||||
* Replace a single document matching the {@link Criteria} of given {@link Query} with the {@code replacement}
|
||||
* document taking {@link ReplaceOptions} into account.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record. The query may
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document. The query may
|
||||
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
|
||||
* to use. Must not be {@literal null}.
|
||||
* @param entityType the type used for mapping the {@link Query} to domain type fields. Must not be {@literal null}.
|
||||
|
||||
@@ -418,7 +418,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* The query is specified as a {@link Query} which can be created either using the {@link BasicQuery} or the more
|
||||
* feature rich {@link Query}.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification.
|
||||
* @param entityClass the parametrized type of the returned {@link Mono}.
|
||||
* @return the converted object.
|
||||
@@ -433,7 +433,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* The query is specified as a {@link Query} which can be created either using the {@link BasicQuery} or the more
|
||||
* feature rich {@link Query}.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification.
|
||||
* @param entityClass the parametrized type of the returned {@link Mono}.
|
||||
* @param collectionName name of the collection to retrieve the objects from.
|
||||
@@ -446,7 +446,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* <strong>NOTE:</strong> Any additional support for query/field mapping, etc. is not available due to the lack of
|
||||
* domain type information. Use {@link #exists(Query, Class, String)} to get full type specific support.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the criteria used to find a record.
|
||||
* @param query the {@link Query} class that specifies the criteria used to find a document.
|
||||
* @param collectionName name of the collection to check for objects.
|
||||
* @return {@literal true} if the query yields a result.
|
||||
*/
|
||||
@@ -455,7 +455,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
/**
|
||||
* Determine result of given {@link Query} contains at least one element.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the criteria used to find a record.
|
||||
* @param query the {@link Query} class that specifies the criteria used to find a document.
|
||||
* @param entityClass the parametrized type.
|
||||
* @return {@literal true} if the query yields a result.
|
||||
*/
|
||||
@@ -464,7 +464,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
/**
|
||||
* Determine result of given {@link Query} contains at least one element.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the criteria used to find a record.
|
||||
* @param query the {@link Query} class that specifies the criteria used to find a document.
|
||||
* @param entityClass the parametrized type. Can be {@literal null}.
|
||||
* @param collectionName name of the collection to check for objects.
|
||||
* @return {@literal true} if the query yields a result.
|
||||
@@ -479,7 +479,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* The query is specified as a {@link Query} which can be created either using the {@link BasicQuery} or the more
|
||||
* feature rich {@link Query}.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification. Must not be {@literal null}.
|
||||
* @param entityClass the parametrized type of the returned {@link Flux}. Must not be {@literal null}.
|
||||
* @return the {@link Flux} of converted objects.
|
||||
@@ -493,7 +493,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* The query is specified as a {@link Query} which can be created either using the {@link BasicQuery} or the more
|
||||
* feature rich {@link Query}.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification. Must not be {@literal null}.
|
||||
* @param entityClass the parametrized type of the returned {@link Flux}.
|
||||
* @param collectionName name of the collection to retrieve the objects from. Must not be {@literal null}.
|
||||
@@ -514,7 +514,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* sort properties} as MongoDB does not support criteria to reconstruct a query result from absent document fields or
|
||||
* {@code null} values through {@code $gt/$lt} operators.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification. Must not be {@literal null}.
|
||||
* @param entityType the parametrized type of the returned list.
|
||||
* @return {@link Mono} emitting the converted window.
|
||||
@@ -539,7 +539,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* sort properties} as MongoDB does not support criteria to reconstruct a query result from absent document fields or
|
||||
* {@code null} values through {@code $gt/$lt} operators.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification. Must not be {@literal null}.
|
||||
* @param entityType the parametrized type of the returned list.
|
||||
* @param collectionName name of the collection to retrieve the objects from.
|
||||
@@ -759,7 +759,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* Triggers <a href="https://docs.mongodb.org/manual/reference/method/db.collection.findAndModify/">findAndModify</a>
|
||||
* 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
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param update the {@link UpdateDefinition} to apply on matching documents. Must not be {@literal null}.
|
||||
* @param entityClass the parametrized type. Must not be {@literal null}.
|
||||
@@ -774,7 +774,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* Triggers <a href="https://docs.mongodb.org/manual/reference/method/db.collection.findAndModify/">findAndModify</a>
|
||||
* 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
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param update the {@link UpdateDefinition} to apply on matching documents. Must not be {@literal null}.
|
||||
* @param entityClass the parametrized type. Must not be {@literal null}.
|
||||
@@ -791,7 +791,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* 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
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification.
|
||||
* @param update the {@link UpdateDefinition} to apply on matching documents.
|
||||
* @param options the {@link FindAndModifyOptions} holding additional information.
|
||||
@@ -809,7 +809,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* 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
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param update the {@link UpdateDefinition} to apply on matching documents. Must not be {@literal null}.
|
||||
* @param options the {@link FindAndModifyOptions} holding additional information. Must not be {@literal null}.
|
||||
@@ -832,7 +832,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* Options are defaulted to {@link FindAndReplaceOptions#empty()}. <br />
|
||||
* <strong>NOTE:</strong> The replacement entity must not hold an {@literal id}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
* @return the converted object that was updated or {@link Mono#empty()}, if not found.
|
||||
@@ -852,7 +852,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* Options are defaulted to {@link FindAndReplaceOptions#empty()}. <br />
|
||||
* <strong>NOTE:</strong> The replacement entity must not hold an {@literal id}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
* @param collectionName the collection to query. Must not be {@literal null}.
|
||||
@@ -870,7 +870,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* taking {@link FindAndReplaceOptions} into account. <br />
|
||||
* <strong>NOTE:</strong> The replacement entity must not hold an {@literal id}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
* @param options the {@link FindAndModifyOptions} holding additional information. Must not be {@literal null}.
|
||||
@@ -892,7 +892,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* taking {@link FindAndReplaceOptions} into account. <br />
|
||||
* <strong>NOTE:</strong> The replacement entity must not hold an {@literal id}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
* @param options the {@link FindAndModifyOptions} holding additional information. Must not be {@literal null}.
|
||||
@@ -914,7 +914,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* taking {@link FindAndReplaceOptions} into account. <br />
|
||||
* <strong>NOTE:</strong> The replacement entity must not hold an {@literal id}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
* @param options the {@link FindAndModifyOptions} holding additional information. Must not be {@literal null}.
|
||||
@@ -938,7 +938,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* taking {@link FindAndReplaceOptions} into account. <br />
|
||||
* <strong>NOTE:</strong> The replacement entity must not hold an {@literal id}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
* @param options the {@link FindAndModifyOptions} holding additional information. Must not be {@literal null}.
|
||||
@@ -967,7 +967,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* taking {@link FindAndReplaceOptions} into account. <br />
|
||||
* <strong>NOTE:</strong> The replacement entity must not hold an {@literal id}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document and also an optional
|
||||
* fields specification. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
* @param options the {@link FindAndModifyOptions} holding additional information. Must not be {@literal null}.
|
||||
@@ -992,7 +992,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* The query is specified as a {@link Query} which can be created either using the {@link BasicQuery} or the more
|
||||
* feature rich {@link Query}.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification.
|
||||
* @param entityClass the parametrized type of the returned {@link Mono}.
|
||||
* @return the converted object
|
||||
@@ -1008,7 +1008,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* The query is specified as a {@link Query} which can be created either using the {@link BasicQuery} or the more
|
||||
* feature rich {@link Query}.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification.
|
||||
* @param entityClass the parametrized type of the returned {@link Mono}.
|
||||
* @param collectionName name of the collection to retrieve the objects from.
|
||||
@@ -1370,7 +1370,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* <strong>NOTE:</strong> {@link Query#getSortObject() sorting} is not supported by {@code db.collection.updateOne}.
|
||||
* Use {@link #findAndModify(Query, UpdateDefinition, Class)} instead.
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to select a record to be upserted. Must not be
|
||||
* @param query the query document that specifies the criteria used to select a document to be upserted. 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}.
|
||||
@@ -1391,7 +1391,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* domain type information. Use {@link #upsert(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 upserted. Must not be
|
||||
* @param query the query document that specifies the criteria used to select a document to be upserted. 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}.
|
||||
@@ -1407,7 +1407,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* 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
|
||||
* @param query the query document that specifies the criteria used to select a document to be upserted. 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}.
|
||||
@@ -1426,7 +1426,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* <strong>NOTE:</strong> {@link Query#getSortObject() sorting} is not supported by {@code db.collection.updateOne}.
|
||||
* Use {@link #findAndModify(Query, UpdateDefinition, Class)} instead.
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to select a record to be updated. Must not be
|
||||
* @param query the query document that specifies the criteria used to select a document to be updated. 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}.
|
||||
@@ -1449,7 +1449,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* <strong>NOTE:</strong> {@link Query#getSortObject() sorting} is not supported by {@code db.collection.updateOne}.
|
||||
* Use {@link #findAndModify(Query, UpdateDefinition, Class, String)} instead.
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to select a record to be updated. Must not be
|
||||
* @param query the query document that specifies the criteria used to select a document to be updated. 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}.
|
||||
@@ -1465,7 +1465,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* Updates the first object that is found in the specified collection that matches the query document criteria with
|
||||
* the provided updated document. <br />
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to select a record to be updated. Must not be
|
||||
* @param query the query document that specifies the criteria used to select a document to be updated. 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}.
|
||||
@@ -1482,7 +1482,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* 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
|
||||
* @param query the query document that specifies the criteria used to select a document to be updated. 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}.
|
||||
@@ -1503,7 +1503,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* 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
|
||||
* @param query the query document that specifies the criteria used to select a document to be updated. 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}.
|
||||
@@ -1519,7 +1519,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* 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
|
||||
* @param query the query document that specifies the criteria used to select a document to be updated. 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}.
|
||||
@@ -1546,7 +1546,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* Removes the given object from the given collection.
|
||||
*
|
||||
* @param object must not be {@literal null}.
|
||||
* @param collectionName name of the collection where the objects will removed, must not be {@literal null} or empty.
|
||||
* @param collectionName name of the collection where the documents will be removed from, must not be {@literal null} or empty.
|
||||
* @return the {@link DeleteResult} which lets you access the results of the previous delete.
|
||||
*/
|
||||
Mono<DeleteResult> remove(Object object, String collectionName);
|
||||
@@ -1565,7 +1565,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* Removes the given object from the given collection.
|
||||
*
|
||||
* @param objectToRemove must not be {@literal null}.
|
||||
* @param collectionName name of the collection where the objects will removed, must not be {@literal null} or empty.
|
||||
* @param collectionName name of the collection where the documents will be removed from, must not be {@literal null} or empty.
|
||||
* @return the {@link DeleteResult} which lets you access the results of the previous delete.
|
||||
*/
|
||||
Mono<DeleteResult> remove(Mono<? extends Object> objectToRemove, String collectionName);
|
||||
@@ -1574,7 +1574,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* Remove all documents that match the provided query document criteria from the collection used to store the
|
||||
* entityClass. The Class parameter is also used to help convert the Id of the object if it is present in the query.
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to remove a record.
|
||||
* @param query the query document that specifies the criteria used to remove a document.
|
||||
* @param entityClass class that determines the collection to use.
|
||||
* @return the {@link DeleteResult} which lets you access the results of the previous delete.
|
||||
* @throws org.springframework.data.mapping.MappingException if the target collection name cannot be
|
||||
@@ -1586,9 +1586,9 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* Remove all documents that match the provided query document criteria from the collection used to store the
|
||||
* entityClass. The Class parameter is also used to help convert the Id of the object if it is present in the query.
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to remove a record.
|
||||
* @param query the query document that specifies the criteria used to remove a document.
|
||||
* @param entityClass class of the pojo to be operated on. Can be {@literal null}.
|
||||
* @param collectionName name of the collection where the objects will removed, must not be {@literal null} or empty.
|
||||
* @param collectionName name of the collection where the documents will be removed from, must not be {@literal null} or empty.
|
||||
* @return the {@link DeleteResult} which lets you access the results of the previous delete.
|
||||
*/
|
||||
Mono<DeleteResult> remove(Query query, @Nullable Class<?> entityClass, String collectionName);
|
||||
@@ -1599,8 +1599,8 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* <strong>NOTE:</strong> Any additional support for field mapping is not available due to the lack of domain type
|
||||
* information. Use {@link #remove(Query, Class, String)} to get full type specific support.
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to remove a record.
|
||||
* @param collectionName name of the collection where the objects will removed, must not be {@literal null} or empty.
|
||||
* @param query the query document that specifies the criteria used to remove a document.
|
||||
* @param collectionName name of the collection where the documents will be removed from, must not be {@literal null} or empty.
|
||||
* @return the {@link DeleteResult} which lets you access the results of the previous delete.
|
||||
*/
|
||||
Mono<DeleteResult> remove(Query query, String collectionName);
|
||||
@@ -1611,7 +1611,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* information. Use {@link #findAllAndRemove(Query, Class, String)} to get full type specific support.
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to find and remove documents.
|
||||
* @param collectionName name of the collection where the objects will removed, must not be {@literal null} or empty.
|
||||
* @param collectionName name of the collection where the documents will be removed from, must not be {@literal null} or empty.
|
||||
* @return the {@link Flux} converted objects deleted by this operation.
|
||||
*/
|
||||
<T> Flux<T> findAllAndRemove(Query query, String collectionName);
|
||||
@@ -1634,7 +1634,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
*
|
||||
* @param query the query document that specifies the criteria used to find and remove documents.
|
||||
* @param entityClass class of the pojo to be operated on.
|
||||
* @param collectionName name of the collection where the objects will removed, must not be {@literal null} or empty.
|
||||
* @param collectionName name of the collection where the documents will be removed from, must not be {@literal null} or empty.
|
||||
* @return the {@link Flux} converted objects deleted by this operation.
|
||||
*/
|
||||
<T> Flux<T> findAllAndRemove(Query query, Class<T> entityClass, String collectionName);
|
||||
@@ -1645,7 +1645,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* The collection name is derived from the {@literal replacement} type. <br />
|
||||
* Options are defaulted to {@link ReplaceOptions#none()}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record. The query may
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document. The query may
|
||||
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
|
||||
* to use. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
@@ -1662,7 +1662,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* Replace a single document matching the {@link Criteria} of given {@link Query} with the {@code replacement}
|
||||
* document. Options are defaulted to {@link ReplaceOptions#none()}.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record. The query may
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document. The query may
|
||||
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
|
||||
* to use. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
@@ -1680,7 +1680,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* Replace a single document matching the {@link Criteria} of given {@link Query} with the {@code replacement}
|
||||
* document taking {@link ReplaceOptions} into account.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record.The query may
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document.The query may
|
||||
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
|
||||
* to use. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
@@ -1698,7 +1698,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* Replace a single document matching the {@link Criteria} of given {@link Query} with the {@code replacement}
|
||||
* document taking {@link ReplaceOptions} into account.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record. The query may *
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document. The query may *
|
||||
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
|
||||
* to use. Must not be {@literal null}.
|
||||
* @param replacement the replacement document. Must not be {@literal null}.
|
||||
@@ -1718,7 +1718,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* Replace a single document matching the {@link Criteria} of given {@link Query} with the {@code replacement}
|
||||
* document taking {@link ReplaceOptions} into account.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record. The query may
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document. The query may
|
||||
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
|
||||
* to use. Must not be {@literal null}.
|
||||
* @param entityType the type used for mapping the {@link Query} to domain type fields and deriving the collection
|
||||
@@ -1738,7 +1738,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* Replace a single document matching the {@link Criteria} of given {@link Query} with the {@code replacement}
|
||||
* document taking {@link ReplaceOptions} into account.
|
||||
*
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record. The query may
|
||||
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a document. The query may
|
||||
* contain an index {@link Query#withHint(String) hint} or the {@link Query#collation(Collation) collation}
|
||||
* to use. Must not be {@literal null}.
|
||||
* @param entityType the type used for mapping the {@link Query} to domain type fields. Must not be {@literal null}.
|
||||
@@ -1761,7 +1761,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* The query is specified as a {@link Query} which can be created either using the {@link BasicQuery} or the more
|
||||
* feature rich {@link Query}.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification.
|
||||
* @param entityClass the parametrized type of the returned {@link Flux}.
|
||||
* @return the {@link Flux} of converted objects.
|
||||
@@ -1780,7 +1780,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations {
|
||||
* The query is specified as a {@link Query} which can be created either using the {@link BasicQuery} or the more
|
||||
* feature rich {@link Query}.
|
||||
*
|
||||
* @param query the query class that specifies the criteria used to find a record and also an optional fields
|
||||
* @param query the query class that specifies the criteria used to find a document and also an optional fields
|
||||
* specification.
|
||||
* @param entityClass the parametrized type of the returned {@link Flux}.
|
||||
* @param collectionName name of the collection to retrieve the objects from.
|
||||
|
||||
@@ -481,7 +481,7 @@ WARNING: `upsert` does not support ordering. Please use xref:mongodb/template-cr
|
||||
[[mongo-template.replace]]
|
||||
=== Replacing Documents in a Collection
|
||||
|
||||
The various `replace` methods available via `MongoTemplate` allow to override a single matching Document.
|
||||
The various `replace` methods available via `MongoTemplate` allow to override the first matching Document.
|
||||
If no match is found a new one can be upserted (as outlined in the previous section) by providing `ReplaceOptions` with according configuration.
|
||||
|
||||
====
|
||||
@@ -504,7 +504,7 @@ Person tom = new Person("id-123", "Tom", 21) <1>
|
||||
Query query = Query.query(Criteria.where("firstName").is(tom.getFirstName()));
|
||||
template.replace(query, tom, ReplaceOptions.replaceOptions().upsert()); <2>
|
||||
----
|
||||
<1> The `_id` value needs to be provided for upsert, otherwise MongoDB will generate an `ObjectId`.
|
||||
<1> The `_id` value needs to be present for upsert, otherwise MongoDB will create a new potentially with the domain type incompatible `ObjectId`.
|
||||
As MongoDB is not aware of your domain type, any `@Field(targetType)` hints are not considered and the resulting `ObjectId` might be not compatible with your domain model.
|
||||
<2> Use `upsert` to insert a new document if no match is found
|
||||
====
|
||||
|
||||
Reference in New Issue
Block a user