@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
/ *
* Copyright 2011 - 2016 the original author or authors .
*
* Copyright 2011 - 2017 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
@ -23,6 +23,7 @@ import org.bson.Document;
@@ -23,6 +23,7 @@ import org.bson.Document;
import org.springframework.data.geo.GeoResults ;
import org.springframework.data.mongodb.core.BulkOperations.BulkMode ;
import org.springframework.data.mongodb.core.aggregation.Aggregation ;
import org.springframework.data.mongodb.core.aggregation.AggregationOptions ;
import org.springframework.data.mongodb.core.aggregation.AggregationResults ;
import org.springframework.data.mongodb.core.aggregation.TypedAggregation ;
import org.springframework.data.mongodb.core.convert.MongoConverter ;
@ -38,7 +39,6 @@ import org.springframework.data.mongodb.core.query.Update;
@@ -38,7 +39,6 @@ import org.springframework.data.mongodb.core.query.Update;
import org.springframework.data.util.CloseableIterator ;
import com.mongodb.Cursor ;
import com.mongodb.DB ;
import com.mongodb.ReadPreference ;
import com.mongodb.client.MongoCollection ;
import com.mongodb.client.result.DeleteResult ;
@ -48,7 +48,7 @@ import com.mongodb.client.result.UpdateResult;
@@ -48,7 +48,7 @@ import com.mongodb.client.result.UpdateResult;
* Interface that specifies a basic set of MongoDB operations . Implemented by { @link MongoTemplate } . Not often used but
* a useful option for extensibility and testability ( as it can be easily mocked , stubbed , or be the target of a JDK
* proxy ) .
*
*
* @author Thomas Risberg
* @author Mark Pollack
* @author Oliver Gierke
@ -56,13 +56,13 @@ import com.mongodb.client.result.UpdateResult;
@@ -56,13 +56,13 @@ import com.mongodb.client.result.UpdateResult;
* @author Chuong Ngo
* @author Christoph Strobl
* @author Thomas Darimont
* @author maninder
* @author Maninder Singh
* /
public interface MongoOperations {
/ * *
* The collection name used for the specified class by this template .
*
*
* @param entityClass must not be { @literal null } .
* @return
* /
@ -72,7 +72,7 @@ public interface MongoOperations {
@@ -72,7 +72,7 @@ public interface MongoOperations {
* Execute the a MongoDB command expressed as a JSON string . This will call the method JSON . parse that is part of the
* MongoDB driver to convert the JSON string to a Document . Any errors that result from executing this command will be
* converted into Spring ' s DAO exception hierarchy .
*
*
* @param jsonCommand a MongoDB command expressed as a JSON string .
* /
Document executeCommand ( String jsonCommand ) ;
@ -80,7 +80,7 @@ public interface MongoOperations {
@@ -80,7 +80,7 @@ public interface MongoOperations {
/ * *
* Execute a MongoDB command . Any errors that result from executing this command will be converted into Spring ' s DAO
* exception hierarchy .
*
*
* @param command a MongoDB command
* /
Document executeCommand ( Document command ) ;
@ -88,7 +88,7 @@ public interface MongoOperations {
@@ -88,7 +88,7 @@ public interface MongoOperations {
/ * *
* Execute a MongoDB command . Any errors that result from executing this command will be converted into Spring ' s data
* access exception hierarchy .
*
*
* @param command a MongoDB command , must not be { @literal null } .
* @param readPreference read preferences to use , can be { @literal null } .
* @return
@ -98,7 +98,7 @@ public interface MongoOperations {
@@ -98,7 +98,7 @@ public interface MongoOperations {
/ * *
* 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
* specification
* @param collectionName name of the collection to retrieve the objects from
@ -110,7 +110,7 @@ public interface MongoOperations {
@@ -110,7 +110,7 @@ public interface MongoOperations {
* Executes a { @link DbCallback } translating any exceptions as necessary .
* < p / >
* Allows for returning a result object , that is a domain object or a collection of domain objects .
*
*
* @param < T > return type
* @param action callback object that specifies the MongoDB actions to perform on the passed in DB instance .
* @return a result object returned by the action or < tt > null < / tt >
@ -121,7 +121,7 @@ public interface MongoOperations {
@@ -121,7 +121,7 @@ public interface MongoOperations {
* Executes the given { @link CollectionCallback } on the entity collection of the specified class .
* < p / >
* Allows for returning a result object , that is a domain object or a collection of domain objects .
*
*
* @param entityClass class that determines the collection to use
* @param < T > return type
* @param action callback object that specifies the MongoDB action
@ -133,7 +133,7 @@ public interface MongoOperations {
@@ -133,7 +133,7 @@ public interface MongoOperations {
* Executes the given { @link CollectionCallback } on the collection of the given name .
* < p / >
* Allows for returning a result object , that is a domain object or a collection of domain objects .
*
*
* @param < T > return type
* @param collectionName the name of the collection that specifies which DBCollection instance will be passed into
* @param action callback object that specifies the MongoDB action the callback action .
@ -146,7 +146,7 @@ public interface MongoOperations {
@@ -146,7 +146,7 @@ public interface MongoOperations {
* { @link Cursor } .
* < p >
* Returns a { @link CloseableIterator } that wraps the a Mongo DB { @link Cursor } that needs to be closed .
*
*
* @param < T > element return type
* @param query must not be { @literal null } .
* @param entityType must not be { @literal null } .
@ -160,7 +160,7 @@ public interface MongoOperations {
@@ -160,7 +160,7 @@ public interface MongoOperations {
* by a Mongo DB { @link Cursor } .
* < p >
* Returns a { @link CloseableIterator } that wraps the a Mongo DB { @link Cursor } that needs to be closed .
*
*
* @param < T > element return type
* @param query must not be { @literal null } .
* @param entityType must not be { @literal null } .
@ -172,7 +172,7 @@ public interface MongoOperations {
@@ -172,7 +172,7 @@ public interface MongoOperations {
/ * *
* Create an uncapped collection with a name based on the provided entity class .
*
*
* @param entityClass class that determines the collection to create
* @return the created collection
* /
@ -180,7 +180,7 @@ public interface MongoOperations {
@@ -180,7 +180,7 @@ public interface MongoOperations {
/ * *
* Create a collection with a name based on the provided entity class using the options .
*
*
* @param entityClass class that determines the collection to create
* @param collectionOptions options to use when creating the collection .
* @return the created collection
@ -189,7 +189,7 @@ public interface MongoOperations {
@@ -189,7 +189,7 @@ public interface MongoOperations {
/ * *
* Create an uncapped collection with the provided name .
*
*
* @param collectionName name of the collection
* @return the created collection
* /
@ -197,7 +197,7 @@ public interface MongoOperations {
@@ -197,7 +197,7 @@ public interface MongoOperations {
/ * *
* Create a collection with the provided name and options .
*
*
* @param collectionName name of the collection
* @param collectionOptions options to use when creating the collection .
* @return the created collection
@ -206,7 +206,7 @@ public interface MongoOperations {
@@ -206,7 +206,7 @@ public interface MongoOperations {
/ * *
* A set of collection names .
*
*
* @return list of collection names
* /
Set < String > getCollectionNames ( ) ;
@ -215,7 +215,7 @@ public interface MongoOperations {
@@ -215,7 +215,7 @@ public interface MongoOperations {
* Get a collection by name , creating it if it doesn ' t exist .
* < p / >
* Translate any exceptions as necessary .
*
*
* @param collectionName name of the collection
* @return an existing collection or a newly created one .
* /
@ -225,7 +225,7 @@ public interface MongoOperations {
@@ -225,7 +225,7 @@ public interface MongoOperations {
* Check to see if a collection with a name indicated by the entity class exists .
* < p / >
* Translate any exceptions as necessary .
*
*
* @param entityClass class that determines the name of the collection
* @return true if a collection with the given name is found , false otherwise .
* /
@ -235,7 +235,7 @@ public interface MongoOperations {
@@ -235,7 +235,7 @@ public interface MongoOperations {
* Check to see if a collection with a given name exists .
* < p / >
* Translate any exceptions as necessary .
*
*
* @param collectionName name of the collection
* @return true if a collection with the given name is found , false otherwise .
* /
@ -245,7 +245,7 @@ public interface MongoOperations {
@@ -245,7 +245,7 @@ public interface MongoOperations {
* Drop the collection with the name indicated by the entity class .
* < p / >
* Translate any exceptions as necessary .
*
*
* @param entityClass class that determines the collection to drop / delete .
* /
< T > void dropCollection ( Class < T > entityClass ) ;
@ -254,21 +254,21 @@ public interface MongoOperations {
@@ -254,21 +254,21 @@ public interface MongoOperations {
* Drop the collection with the given name .
* < p / >
* Translate any exceptions as necessary .
*
*
* @param collectionName name of the collection to drop / delete .
* /
void dropCollection ( String collectionName ) ;
/ * *
* Returns the operations that can be performed on indexes
*
*
* @return index operations on the named collection
* /
IndexOperations indexOps ( String collectionName ) ;
/ * *
* Returns the operations that can be performed on indexes
*
*
* @return index operations on the named collection associated with the given entity class
* /
IndexOperations indexOps ( Class < ? > entityClass ) ;
@ -283,7 +283,7 @@ public interface MongoOperations {
@@ -283,7 +283,7 @@ public interface MongoOperations {
/ * *
* Returns a new { @link BulkOperations } for the given collection .
*
*
* @param mode the { @link BulkMode } to use for bulk operations , must not be { @literal null } .
* @param collectionName the name of the collection to work on , must not be { @literal null } or empty .
* @return { @link BulkOperations } on the named collection
@ -292,7 +292,7 @@ public interface MongoOperations {
@@ -292,7 +292,7 @@ public interface MongoOperations {
/ * *
* Returns a new { @link BulkOperations } for the given entity type .
*
*
* @param mode the { @link BulkMode } to use for bulk operations , must not be { @literal null } .
* @param entityType the name of the entity class , must not be { @literal null } .
* @return { @link BulkOperations } on the named collection associated of the given entity class .
@ -301,7 +301,7 @@ public interface MongoOperations {
@@ -301,7 +301,7 @@ public interface MongoOperations {
/ * *
* Returns a new { @link BulkOperations } for the given entity type and collection name .
*
*
* @param mode the { @link BulkMode } to use for bulk operations , must not be { @literal null } .
* @param entityClass the name of the entity class , must not be { @literal null } .
* @param collectionName the name of the collection to work on , must not be { @literal null } or empty .
@ -317,7 +317,7 @@ public interface MongoOperations {
@@ -317,7 +317,7 @@ public interface MongoOperations {
* < p / >
* If your collection does not contain a homogeneous collection of types , this operation will not be an efficient way
* to map objects since the test for class type is done in the client and not on the server .
*
*
* @param entityClass the parameterized type of the returned list
* @return the converted collection
* /
@ -331,7 +331,7 @@ public interface MongoOperations {
@@ -331,7 +331,7 @@ public interface MongoOperations {
* < p / >
* If your collection does not contain a homogeneous collection of types , this operation will not be an efficient way
* to map objects since the test for class type is done in the client and not on the server .
*
*
* @param entityClass the parameterized type of the returned list .
* @param collectionName name of the collection to retrieve the objects from
* @return the converted collection
@ -341,7 +341,7 @@ public interface MongoOperations {
@@ -341,7 +341,7 @@ public interface MongoOperations {
/ * *
* Execute a group operation over the entire collection . The group operation entity class should match the ' shape ' of
* the returned object that takes int account the initial document structure as well as any finalize functions .
*
*
* @param criteria The criteria that restricts the row that are considered for grouping . If not specified all rows are
* considered .
* @param inputCollectionName the collection where the group operation will read from
@ -356,7 +356,7 @@ public interface MongoOperations {
@@ -356,7 +356,7 @@ public interface MongoOperations {
* Execute a group operation restricting the rows to those which match the provided Criteria . The group operation
* entity class should match the ' shape ' of the returned object that takes int account the initial document structure
* as well as any finalize functions .
*
*
* @param criteria The criteria that restricts the row that are considered for grouping . If not specified all rows are
* considered .
* @param inputCollectionName the collection where the group operation will read from
@ -370,7 +370,7 @@ public interface MongoOperations {
@@ -370,7 +370,7 @@ public interface MongoOperations {
/ * *
* Execute an aggregation operation . The raw results will be mapped to the given entity class . The name of the
* inputCollection is derived from the inputType of the aggregation .
*
*
* @param aggregation The { @link TypedAggregation } specification holding the aggregation operations , must not be
* { @literal null } .
* @param collectionName The name of the input collection to use for the aggreation .
@ -380,13 +380,10 @@ public interface MongoOperations {
@@ -380,13 +380,10 @@ public interface MongoOperations {
* /
< O > AggregationResults < O > aggregate ( TypedAggregation < ? > aggregation , String collectionName , Class < O > outputType ) ;
< O > CloseableIterator < O > aggregateStream ( TypedAggregation < ? > aggregation , String inputCollectionName ,
Class < O > outputType ) ;
/ * *
* Execute an aggregation operation . The raw results will be mapped to the given entity class . The name of the
* inputCollection is derived from the inputType of the aggregation .
*
*
* @param aggregation The { @link TypedAggregation } specification holding the aggregation operations , must not be
* { @literal null } .
* @param outputType The parameterized type of the returned list , must not be { @literal null } .
@ -396,52 +393,109 @@ public interface MongoOperations {
@@ -396,52 +393,109 @@ public interface MongoOperations {
< O > AggregationResults < O > aggregate ( TypedAggregation < ? > aggregation , Class < O > outputType ) ;
/ * *
* Execute an aggregation operation . The raw results will be mapped to the given entity class and are returned as
* stream . The name of the inputCollection is derived from the inputType of the aggregation .
* Execute an aggregation operation . The raw results will be mapped to the given entity class .
*
* @param aggregation The { @link Typed Aggregation} specification holding the aggregation operations , must not be
* @param aggregation The { @link Aggregation } specification holding the aggregation operations , must not be
* { @literal null } .
* @param inputType the inputType where the aggregation operation will read from , must not be { @literal null } or
* empty .
* @param outputType The parameterized type of the returned list , must not be { @literal null } .
* @return The results of the aggregation operation .
* @since 1 . 11 . 0
* @since 1 . 3
* /
< O > CloseableIterator < O > aggregateStream ( TypedAggregation < ? > aggregation , Class < O > outputType ) ;
< O > AggregationResults < O > aggregate ( Aggregation aggregation , Class < ? > inputType , Class < O > outputType ) ;
/ * *
* Execute an aggregation operation . The raw results will be mapped to the given entity class .
*
*
* @param aggregation The { @link Aggregation } specification holding the aggregation operations , must not be
* { @literal null } .
* @param inputTyp e the inputType where the aggregation operation will read from , must not be { @literal null } or
* @param collectionNam e the collect io n where the aggregation operation will read from , must not be { @literal null } or
* empty .
* @param outputType The parameterized type of the returned list , must not be { @literal null } .
* @return The results of the aggregation operation .
* @since 1 . 3
* /
< O > AggregationResults < O > aggregate ( Aggregation aggregation , Class < ? > inputType , Class < O > outputType ) ;
< O > AggregationResults < O > aggregate ( Aggregation aggregation , String collectionName , Class < O > outputType ) ;
/ * *
* Execute an aggregation operation backed by a Mongo DB { @link Cursor } .
* < p >
* Returns a { @link CloseableIterator } that wraps the a Mongo DB { @link Cursor } that needs to be closed . The raw
* results will be mapped to the given entity class . The name of the inputCollection is derived from the inputType of
* the aggregation .
* < p >
* Aggregation streaming can ' t be used with { @link AggregationOptions # isExplain ( ) aggregation explain } . Enabling
* explanation mode will throw an { @link IllegalArgumentException } .
*
* @param aggregation The { @link TypedAggregation } specification holding the aggregation operations , must not be
* { @literal null } .
* @param collectionName The name of the input collection to use for the aggreation .
* @param outputType The parameterized type of the returned list , must not be { @literal null } .
* @return The results of the aggregation operation .
* @since 2 . 0
* /
< O > CloseableIterator < O > aggregateStream ( TypedAggregation < ? > aggregation , String collectionName , Class < O > outputType ) ;
/ * *
* Execute an aggregation operation backed by a Mongo DB { @link Cursor } .
* < p / >
* Returns a { @link CloseableIterator } that wraps the a Mongo DB { @link Cursor } that needs to be closed . The raw
* results will be mapped to the given entity class and are returned as stream . The name of the inputCollection is
* derived from the inputType of the aggregation .
* < p / >
* Aggregation streaming can ' t be used with { @link AggregationOptions # isExplain ( ) aggregation explain } . Enabling
* explanation mode will throw an { @link IllegalArgumentException } .
*
* @param aggregation The { @link TypedAggregation } specification holding the aggregation operations , must not be
* { @literal null } .
* @param outputType The parameterized type of the returned list , must not be { @literal null } .
* @return The results of the aggregation operation .
* @since 2 . 0
* /
< O > CloseableIterator < O > aggregateStream ( TypedAggregation < ? > aggregation , Class < O > outputType ) ;
/ * *
* Execute an aggregation operation backed by a Mongo DB { @link Cursor } .
* < p / >
* Returns a { @link CloseableIterator } that wraps the a Mongo DB { @link Cursor } that needs to be closed . The raw
* results will be mapped to the given entity class .
* < p / >
* Aggregation streaming can ' t be used with { @link AggregationOptions # isExplain ( ) aggregation explain } . Enabling
* explanation mode will throw an { @link IllegalArgumentException } .
*
* @param aggregation The { @link Aggregation } specification holding the aggregation operations , must not be
* { @literal null } .
* @param inputType the inputType where the aggregation operation will read from , must not be { @literal null } or
* empty .
* @param outputType The parameterized type of the returned list , must not be { @literal null } .
* @return The results of the aggregation operation .
* @since 2 . 0
* /
< O > CloseableIterator < O > aggregateStream ( Aggregation aggregation , Class < ? > inputType , Class < O > outputType ) ;
/ * *
* Execute an aggregation operation . The raw results will be mapped to the given entity class .
*
* Execute an aggregation operation backed by a Mongo DB { @link Cursor } .
* < p / >
* Returns a { @link CloseableIterator } that wraps the a Mongo DB { @link Cursor } that needs to be closed . The raw
* results will be mapped to the given entity class .
* < p / >
* Aggregation streaming can ' t be used with { @link AggregationOptions # isExplain ( ) aggregation explain } . Enabling
* explanation mode will throw an { @link IllegalArgumentException } .
*
* @param aggregation The { @link Aggregation } specification holding the aggregation operations , must not be
* { @literal null } .
* @param collectionName the collection where the aggregation operation will read from , must not be { @literal null } or
* empty .
* @param outputType The parameterized type of the returned list , must not be { @literal null } .
* @return The results of the aggregation operation .
* @since 1 . 3
* @since 2 . 0
* /
< O > AggregationResults < O > aggregate ( Aggregation aggregation , String collectionName , Class < O > outputType ) ;
< O > CloseableIterator < O > aggregateStream ( Aggregation aggregation , String collectionName , Class < O > outputType ) ;
/ * *
* Execute a map - reduce operation . The map - reduce operation will be formed with an output type of INLINE
*
*
* @param inputCollectionName the collection where the map - reduce will read from
* @param mapFunction The JavaScript map function
* @param reduceFunction The JavaScript reduce function
@ -454,7 +508,7 @@ public interface MongoOperations {
@@ -454,7 +508,7 @@ public interface MongoOperations {
/ * *
* Execute a map - reduce operation that takes additional map - reduce options .
*
*
* @param inputCollectionName the collection where the map - reduce will read from
* @param mapFunction The JavaScript map function
* @param reduceFunction The JavaScript reduce function
@ -468,7 +522,7 @@ public interface MongoOperations {
@@ -468,7 +522,7 @@ public interface MongoOperations {
/ * *
* Execute a map - reduce operation that takes a query . The map - reduce operation will be formed with an output type of
* INLINE
*
*
* @param query The query to use to select the data for the map phase
* @param inputCollectionName the collection where the map - reduce will read from
* @param mapFunction The JavaScript map function
@ -482,7 +536,7 @@ public interface MongoOperations {
@@ -482,7 +536,7 @@ public interface MongoOperations {
/ * *
* Execute a map - reduce operation that takes a query and additional map - reduce options
*
*
* @param query The query to use to select the data for the map phase
* @param inputCollectionName the collection where the map - reduce will read from
* @param mapFunction The JavaScript map function
@ -499,7 +553,7 @@ public interface MongoOperations {
@@ -499,7 +553,7 @@ public interface MongoOperations {
* information to determine the collection the query is ran against . Note , that MongoDB limits the number of results
* by default . Make sure to add an explicit limit to the { @link NearQuery } if you expect a particular number of
* results .
*
*
* @param near must not be { @literal null } .
* @param entityClass must not be { @literal null } .
* @return
@ -510,7 +564,7 @@ public interface MongoOperations {
@@ -510,7 +564,7 @@ public interface MongoOperations {
* Returns { @link GeoResults } for all entities matching the given { @link NearQuery } . Note , that MongoDB limits the
* number of results by default . Make sure to add an explicit limit to the { @link NearQuery } if you expect a
* particular number of results .
*
*
* @param near must not be { @literal null } .
* @param entityClass must not be { @literal null } .
* @param collectionName the collection to trigger the query against . If no collection name is given the entity class
@ -528,7 +582,7 @@ public interface MongoOperations {
@@ -528,7 +582,7 @@ public interface MongoOperations {
* < p / >
* 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
* specification
* @param entityClass the parameterized type of the returned list .
@ -545,7 +599,7 @@ public interface MongoOperations {
@@ -545,7 +599,7 @@ public interface MongoOperations {
* < p / >
* 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
* specification
* @param entityClass the parameterized type of the returned list .
@ -556,7 +610,7 @@ public interface MongoOperations {
@@ -556,7 +610,7 @@ public interface MongoOperations {
/ * *
* 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 collectionName name of the collection to check for objects .
* @return
@ -565,7 +619,7 @@ public interface MongoOperations {
@@ -565,7 +619,7 @@ public interface MongoOperations {
/ * *
* 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 entityClass the parameterized type .
* @return
@ -574,7 +628,7 @@ public interface MongoOperations {
@@ -574,7 +628,7 @@ public interface MongoOperations {
/ * *
* 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 entityClass the parameterized type .
* @param collectionName name of the collection to check for objects .
@ -590,7 +644,7 @@ public interface MongoOperations {
@@ -590,7 +644,7 @@ public interface MongoOperations {
* < p / >
* 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
* specification
* @param entityClass the parameterized type of the returned list .
@ -606,7 +660,7 @@ public interface MongoOperations {
@@ -606,7 +660,7 @@ public interface MongoOperations {
* < p / >
* 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
* specification
* @param entityClass the parameterized type of the returned list .
@ -618,7 +672,7 @@ public interface MongoOperations {
@@ -618,7 +672,7 @@ public interface MongoOperations {
/ * *
* Returns a document with the given id mapped onto the given class . The collection the query is ran against will be
* derived from the given target class as well .
*
*
* @param < T >
* @param id the id of the document to return .
* @param entityClass the type the document shall be converted into .
@ -628,7 +682,7 @@ public interface MongoOperations {
@@ -628,7 +682,7 @@ public interface MongoOperations {
/ * *
* Returns the document with the given id from the given collection mapped onto the given target class .
*
*
* @param id the id of the document to return
* @param entityClass the type to convert the document to
* @param collectionName the collection to query for the document
@ -638,9 +692,9 @@ public interface MongoOperations {
@@ -638,9 +692,9 @@ public interface MongoOperations {
< T > T findById ( Object id , Class < T > entityClass , String collectionName ) ;
/ * *
* Triggers < a href = "http://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 } .
*
* Triggers < a href = "http://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
* fields specification .
* @param update the { @link Update } to apply on matching documents .
@ -650,9 +704,9 @@ public interface MongoOperations {
@@ -650,9 +704,9 @@ public interface MongoOperations {
< T > T findAndModify ( Query query , Update update , Class < T > entityClass ) ;
/ * *
* Triggers < a href = "http://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 } .
*
* Triggers < a href = "http://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
* fields specification .
* @param update the { @link Update } to apply on matching documents .
@ -663,10 +717,10 @@ public interface MongoOperations {
@@ -663,10 +717,10 @@ public interface MongoOperations {
< T > T findAndModify ( Query query , Update update , Class < T > entityClass , String collectionName ) ;
/ * *
* Triggers < a href = "http://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 } taking
* Triggers < a href = "http://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 } 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 .
@ -677,10 +731,10 @@ public interface MongoOperations {
@@ -677,10 +731,10 @@ public interface MongoOperations {
< T > T findAndModify ( Query query , Update update , FindAndModifyOptions options , Class < T > entityClass ) ;
/ * *
* Triggers < a href = "http://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 } taking
* Triggers < a href = "http://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 } 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 .
@ -690,7 +744,7 @@ public interface MongoOperations {
@@ -690,7 +744,7 @@ public interface MongoOperations {
* @return
* /
< T > T findAndModify ( Query query , Update update , FindAndModifyOptions options , Class < T > entityClass ,
String collectionName ) ;
String collectionName ) ;
/ * *
* Map the results of an ad - hoc query on the collection for the entity type to a single instance of an object of the
@ -701,7 +755,7 @@ public interface MongoOperations {
@@ -701,7 +755,7 @@ public interface MongoOperations {
* < p / >
* 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
* specification
* @param entityClass the parameterized type of the returned list .
@ -718,7 +772,7 @@ public interface MongoOperations {
@@ -718,7 +772,7 @@ public interface MongoOperations {
* < p / >
* 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
* specification
* @param entityClass the parameterized type of the returned list .
@ -729,7 +783,7 @@ public interface MongoOperations {
@@ -729,7 +783,7 @@ public interface MongoOperations {
/ * *
* Returns the number of documents for the given { @link Query } by querying the collection of the given entity class .
*
*
* @param query
* @param entityClass must not be { @literal null } .
* @return
@ -740,7 +794,7 @@ public interface MongoOperations {
@@ -740,7 +794,7 @@ public interface MongoOperations {
* Returns the number of documents for the given { @link Query } querying the given collection . The given { @link Query }
* must solely consist of document field references as we lack type information to map potential property references
* onto document fields . TO make sure the query gets mapped , use { @link # count ( Query , Class , String ) } .
*
*
* @param query
* @param collectionName must not be { @literal null } or empty .
* @return
@ -751,7 +805,7 @@ public interface MongoOperations {
@@ -751,7 +805,7 @@ public interface MongoOperations {
/ * *
* Returns the number of documents for the given { @link Query } by querying the given collection using the given entity
* class to map the given { @link Query } .
*
*
* @param query
* @param entityClass must not be { @literal null } .
* @param collectionName must not be { @literal null } or empty .
@ -772,7 +826,7 @@ public interface MongoOperations {
@@ -772,7 +826,7 @@ public interface MongoOperations {
* < p / >
* < p / >
* Insert is used to initially store the object into the database . To update an existing object use the save method .
*
*
* @param objectToSave the object to store in the collection .
* /
void insert ( Object objectToSave ) ;
@ -784,7 +838,7 @@ public interface MongoOperations {
@@ -784,7 +838,7 @@ public interface MongoOperations {
* configured otherwise , an instance of MappingMongoConverter will be used .
* < p / >
* Insert is used to initially store the object into the database . To update an existing object use the save method .
*
*
* @param objectToSave the object to store in the collection
* @param collectionName name of the collection to store the object in
* /
@ -792,7 +846,7 @@ public interface MongoOperations {
@@ -792,7 +846,7 @@ public interface MongoOperations {
/ * *
* Insert a Collection of objects into a collection in a single batch write to the database .
*
*
* @param batchToSave the list of objects to save .
* @param entityClass class that determines the collection to use
* /
@ -800,7 +854,7 @@ public interface MongoOperations {
@@ -800,7 +854,7 @@ public interface MongoOperations {
/ * *
* Insert a list of objects into the specified collection in a single batch write to the database .
*
*
* @param batchToSave the list of objects to save .
* @param collectionName name of the collection to store the object in
* /
@ -809,7 +863,7 @@ public interface MongoOperations {
@@ -809,7 +863,7 @@ public interface MongoOperations {
/ * *
* Insert a mixed Collection of objects into a database collection determining the collection name to use based on the
* class .
*
*
* @param collectionToSave the list of objects to save .
* /
void insertAll ( Collection < ? extends Object > objectsToSave ) ;
@ -826,7 +880,7 @@ public interface MongoOperations {
@@ -826,7 +880,7 @@ public interface MongoOperations {
* property type will be handled by Spring ' s BeanWrapper class that leverages Type Conversion API . See
* < a href = "http://docs.spring.io/spring/docs/current/spring-framework-reference/html/validation.html#core-convert" >
* Spring ' s Type Conversion " < / a > for more details .
*
*
* @param objectToSave the object to store in the collection
* /
void save ( Object objectToSave ) ;
@ -843,7 +897,7 @@ public interface MongoOperations {
@@ -843,7 +897,7 @@ public interface MongoOperations {
* property type will be handled by Spring ' s BeanWrapper class that leverages Type Cobnversion API . See < a
* http : //docs.spring.io/spring/docs/current/spring-framework-reference/html/validation.html#core-convert">Spring's
* Type Conversion " < / a > for more details .
*
*
* @param objectToSave the object to store in the collection
* @param collectionName name of the collection to store the object in
* /
@ -852,7 +906,7 @@ public interface MongoOperations {
@@ -852,7 +906,7 @@ public interface MongoOperations {
/ * *
* 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
* @param update the update document that contains the updated object or $ operators to manipulate the existing object
* @param entityClass class that determines the collection to use
@ -863,7 +917,7 @@ public interface MongoOperations {
@@ -863,7 +917,7 @@ public interface MongoOperations {
/ * *
* 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 updated
* @param update the update document that contains the updated object or $ operators to manipulate the existing
* object .
@ -875,7 +929,7 @@ public interface MongoOperations {
@@ -875,7 +929,7 @@ public interface MongoOperations {
/ * *
* 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
* @param update the update document that contains the updated object or $ operators to manipulate the existing object
* @param entityClass class of the pojo to be operated on
@ -887,7 +941,7 @@ public interface MongoOperations {
@@ -887,7 +941,7 @@ public interface MongoOperations {
/ * *
* 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
* @param update the update document that contains the updated object or $ operators to manipulate the existing
* object .
@ -899,7 +953,7 @@ public interface MongoOperations {
@@ -899,7 +953,7 @@ public interface MongoOperations {
/ * *
* 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
* @param update the update document that contains the updated object or $ operators to manipulate the existing
* object .
@ -911,7 +965,7 @@ public interface MongoOperations {
@@ -911,7 +965,7 @@ public interface MongoOperations {
/ * *
* 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
* @param update the update document that contains the updated object or $ operators to manipulate the existing
* object .
@ -924,7 +978,7 @@ public interface MongoOperations {
@@ -924,7 +978,7 @@ public interface MongoOperations {
/ * *
* 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
* @param update the update document that contains the updated object or $ operators to manipulate the existing
* object .
@ -936,7 +990,7 @@ public interface MongoOperations {
@@ -936,7 +990,7 @@ public interface MongoOperations {
/ * *
* Updates all objects that are 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
* @param update the update document that contains the updated object or $ operators to manipulate the existing
* object .
@ -948,7 +1002,7 @@ public interface MongoOperations {
@@ -948,7 +1002,7 @@ public interface MongoOperations {
/ * *
* 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
* @param update the update document that contains the updated object or $ operators to manipulate the existing
* object .
@ -960,14 +1014,14 @@ public interface MongoOperations {
@@ -960,14 +1014,14 @@ public interface MongoOperations {
/ * *
* Remove the given object from the collection by id .
*
*
* @param object
* /
DeleteResult remove ( Object object ) ;
/ * *
* Removes the given object from the given collection .
*
*
* @param object
* @param collection must not be { @literal null } or empty .
* /
@ -976,7 +1030,7 @@ public interface MongoOperations {
@@ -976,7 +1030,7 @@ public interface MongoOperations {
/ * *
* Remove all documents that match the provided query document criteria from the 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
* @param entityClass
* /
@ -985,7 +1039,7 @@ public interface MongoOperations {
@@ -985,7 +1039,7 @@ public interface MongoOperations {
/ * *
* Remove all documents that match the provided query document criteria from the 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
* @param entityClass
* @param collectionName
@ -995,7 +1049,7 @@ public interface MongoOperations {
@@ -995,7 +1049,7 @@ public interface MongoOperations {
/ * *
* Remove all documents from the specified collection that match the provided query document criteria . There is no
* conversion / mapping done for any criteria using the id field .
*
*
* @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
* /
@ -1003,7 +1057,7 @@ public interface MongoOperations {
@@ -1003,7 +1057,7 @@ public interface MongoOperations {
/ * *
* Returns and removes all documents form the specified collection that match the provided query .
*
*
* @param query
* @param collectionName
* @return
@ -1013,7 +1067,7 @@ public interface MongoOperations {
@@ -1013,7 +1067,7 @@ public interface MongoOperations {
/ * *
* Returns and removes all documents matching the given query form the collection used to store the entityClass .
*
*
* @param query
* @param entityClass
* @return
@ -1025,7 +1079,7 @@ public interface MongoOperations {
@@ -1025,7 +1079,7 @@ public interface MongoOperations {
* Returns and removes all documents that match the provided query document criteria from the 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
* @param entityClass
* @param collectionName
@ -1036,7 +1090,7 @@ public interface MongoOperations {
@@ -1036,7 +1090,7 @@ public interface MongoOperations {
/ * *
* Returns the underlying { @link MongoConverter } .
*
*
* @return
* /
MongoConverter getConverter ( ) ;