public class SimpleMongoRepository<T,ID> extends Object implements MongoRepository<T,ID>
Constructor and Description |
---|
SimpleMongoRepository(MongoEntityInformation<T,ID> metadata,
MongoOperations mongoOperations)
|
Modifier and Type | Method and Description |
---|---|
long |
count() |
<S extends T> |
count(org.springframework.data.domain.Example<S> example) |
void |
delete(T entity) |
void |
deleteAll() |
void |
deleteAll(Iterable<? extends T> entities) |
void |
deleteAllById(Iterable<? extends ID> ids) |
void |
deleteById(ID id) |
<S extends T> |
exists(org.springframework.data.domain.Example<S> example) |
boolean |
existsById(ID id) |
List<T> |
findAll() |
<S extends T> |
findAll(org.springframework.data.domain.Example<S> example)
Returns all entities matching the given
Example . |
<S extends T> |
findAll(org.springframework.data.domain.Example<S> example,
org.springframework.data.domain.Pageable pageable) |
<S extends T> |
findAll(org.springframework.data.domain.Example<S> example,
org.springframework.data.domain.Sort sort)
Returns all entities matching the given
Example applying the given Sort . |
org.springframework.data.domain.Page<T> |
findAll(org.springframework.data.domain.Pageable pageable) |
List<T> |
findAll(org.springframework.data.domain.Sort sort) |
Iterable<T> |
findAllById(Iterable<ID> ids) |
<S extends T,R> |
findBy(org.springframework.data.domain.Example<S> example,
Function<org.springframework.data.repository.query.FluentQuery.FetchableFluentQuery<S>,R> queryFunction) |
Optional<T> |
findById(ID id) |
<S extends T> |
findOne(org.springframework.data.domain.Example<S> example) |
<S extends T> |
insert(Iterable<S> entities)
Inserts the given entities.
|
<S extends T> |
insert(S entity)
Inserts the given entity.
|
<S extends T> |
save(S entity) |
<S extends T> |
saveAll(Iterable<S> entities) |
public SimpleMongoRepository(MongoEntityInformation<T,ID> metadata, MongoOperations mongoOperations)
metadata
- must not be null.mongoOperations
- must not be null.public <S extends T> S save(S entity)
public boolean existsById(ID id)
public long count()
public void deleteById(ID id)
public void delete(T entity)
public void deleteAll()
public org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable)
public <S extends T> S insert(S entity)
MongoRepository
CrudRepository.save(Object)
instead to avoid the usage of store-specific API.insert
in interface MongoRepository<T,ID>
entity
- must not be null.public <S extends T> List<S> insert(Iterable<S> entities)
MongoRepository
MongoRepository.saveAll(Iterable)
. Prefer using MongoRepository.saveAll(Iterable)
to avoid the usage of store
specific API.insert
in interface MongoRepository<T,ID>
entities
- must not be null.public <S extends T> Optional<S> findOne(org.springframework.data.domain.Example<S> example)
findOne
in interface org.springframework.data.repository.query.QueryByExampleExecutor<T>
public <S extends T> List<S> findAll(org.springframework.data.domain.Example<S> example)
MongoRepository
Example
. In case no match could be found an empty List
is
returned. Example
uses 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] }
. UntypedExampleMatcher
with
Example.of(Object, org.springframework.data.domain.ExampleMatcher)
.findAll
in interface MongoRepository<T,ID>
findAll
in interface org.springframework.data.repository.query.QueryByExampleExecutor<T>
QueryByExampleExecutor.findAll(org.springframework.data.domain.Example)
public <S extends T> List<S> findAll(org.springframework.data.domain.Example<S> example, org.springframework.data.domain.Sort sort)
MongoRepository
Example
applying the given Sort
. In case no match could be
found an empty List
is returned. Example
uses 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] }
. UntypedExampleMatcher
with
Example.of(Object, org.springframework.data.domain.ExampleMatcher)
.findAll
in interface MongoRepository<T,ID>
findAll
in interface org.springframework.data.repository.query.QueryByExampleExecutor<T>
QueryByExampleExecutor.findAll(org.springframework.data.domain.Example,
org.springframework.data.domain.Sort)
public <S extends T> org.springframework.data.domain.Page<S> findAll(org.springframework.data.domain.Example<S> example, org.springframework.data.domain.Pageable pageable)
findAll
in interface org.springframework.data.repository.query.QueryByExampleExecutor<T>
public <S extends T> long count(org.springframework.data.domain.Example<S> example)
count
in interface org.springframework.data.repository.query.QueryByExampleExecutor<T>
public <S extends T> boolean exists(org.springframework.data.domain.Example<S> example)
exists
in interface org.springframework.data.repository.query.QueryByExampleExecutor<T>
Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.