Interface MongoRepository<T,ID>
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<T,,ID> org.springframework.data.repository.ListCrudRepository<T,,ID> org.springframework.data.repository.ListPagingAndSortingRepository<T,,ID> org.springframework.data.repository.PagingAndSortingRepository<T,,ID> org.springframework.data.repository.query.QueryByExampleExecutor<T>,org.springframework.data.repository.Repository<T,ID>
- All Known Implementing Classes:
SimpleMongoRepository
@NoRepositoryBean
public interface MongoRepository<T,ID>
extends org.springframework.data.repository.ListCrudRepository<T,ID>, org.springframework.data.repository.ListPagingAndSortingRepository<T,ID>, org.springframework.data.repository.query.QueryByExampleExecutor<T>
Mongo specific
Repository interface.- Author:
- Oliver Gierke, Christoph Strobl, Thomas Darimont, Mark Paluch, Khaled Baklouti
-
Method Summary
Modifier and TypeMethodDescriptionfindAll(org.springframework.data.domain.Example<S> example) Returns all entities matching the givenExample.findAll(org.springframework.data.domain.Example<S> example, org.springframework.data.domain.Sort sort) Returns all entities matching the givenExampleapplying the givenSort.Inserts the given entities.<S extends T>
Sinsert(S entity) Inserts the given entity.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
insert
Inserts the given entity. Assumes the instance to be new to be able to apply insertion optimizations. Use the returned instance for further operations as the save operation might have changed the entity instance completely. Prefer usingCrudRepository.save(Object)instead to avoid the usage of store-specific API.- Parameters:
entity- must not be null.- Returns:
- the saved entity
- Since:
- 1.7
-
insert
Inserts the given entities. Assumes the given entities to have not been persisted yet and thus will optimize the insert over a call toListCrudRepository.saveAll(Iterable). Prefer usingListCrudRepository.saveAll(Iterable)to avoid the usage of store specific API.- Parameters:
entities- must not be null.- Returns:
- the saved entities
- Since:
- 1.7
-
findAll
Returns all entities matching the givenExample. In case no match could be found an emptyListis returned.
By default theExampleuses typed matching restricting it to probe assignable types. For example, when sticking with the default type key (_class), the query has restrictions such as_class : { $in : [com.acme.Person] }.
To avoid the above mentioned type restriction use anUntypedExampleMatcherwithExample.of(Object, org.springframework.data.domain.ExampleMatcher).- Specified by:
findAllin interfaceorg.springframework.data.repository.query.QueryByExampleExecutor<T>- See Also:
-
QueryByExampleExecutor.findAll(org.springframework.data.domain.Example)
-
findAll
<S extends T> List<S> findAll(org.springframework.data.domain.Example<S> example, org.springframework.data.domain.Sort sort) Returns all entities matching the givenExampleapplying the givenSort. In case no match could be found an emptyListis returned.
By default theExampleuses typed matching restricting it to probe assignable types. For example, when sticking with the default type key (_class), the query has restrictions such as_class : { $in : [com.acme.Person] }.
To avoid the above mentioned type restriction use anUntypedExampleMatcherwithExample.of(Object, org.springframework.data.domain.ExampleMatcher).- Specified by:
findAllin interfaceorg.springframework.data.repository.query.QueryByExampleExecutor<T>- See Also:
-
QueryByExampleExecutor.findAll(org.springframework.data.domain.Example, org.springframework.data.domain.Sort)
-