Package io.quarkus.mongodb.panache
Interface PanacheMongoRepositoryBase<Entity,Id>
- Type Parameters:
Entity
- The type of entity to operate onId
- The ID type of the entity
- All Known Subinterfaces:
PanacheMongoRepository<Entity>
public interface PanacheMongoRepositoryBase<Entity,Id>
Represents a Repository for a specific type of entity
Entity
, with an ID type
of Id
. Implementing this repository will gain you the exact same useful methods
that are on PanacheMongoEntityBase
. Unless you have a custom ID strategy, you should not
implement this interface directly but implement PanacheMongoRepository
instead.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault long
count()
Counts the number of this type of entity in the database.default long
count
(String query, Parameters params) Counts the number of this type of entity matching the given query, with named parameters.default long
Counts the number of this type of entity matching the given query, with optional indexed parameters.default long
Counts the number of this type of entity matching the given query, with named parameters.default long
count
(org.bson.Document query) Counts the number of this type of entity matching the given querydefault void
Delete the given entity from the database, if it is already persisted.default long
delete
(String query, Parameters params) Delete all entities of this type matching the given query, with named parameters.default long
Delete all entities of this type matching the given query, with optional indexed parameters.default long
Delete all entities of this type matching the given query, with named parameters.default long
delete
(org.bson.Document query) Delete all entities of this type matching the given querydefault long
Delete all entities of this type from the database.default boolean
deleteById
(Id id) Delete an entity of this type by ID.default PanacheQuery<Entity>
find
(String query, Parameters params) Find entities using a query, with named parameters.default PanacheQuery<Entity>
find
(String query, Sort sort, Parameters params) Find entities using a query and the given sort options, with named parameters.default PanacheQuery<Entity>
Find entities using a query and the given sort options, with optional indexed parameters.default PanacheQuery<Entity>
Find entities using a query and the given sort options, with named parameters.default PanacheQuery<Entity>
Find entities using a query, with optional indexed parameters.default PanacheQuery<Entity>
Find entities using a query, with named parameters.default PanacheQuery<Entity>
find
(org.bson.Document query) Find entities using a BSON query.default PanacheQuery<Entity>
find
(org.bson.Document query, org.bson.Document sort) Find entities using a BSON query and a BSON sort.default PanacheQuery<Entity>
findAll()
Find all entities of this type.default PanacheQuery<Entity>
Find all entities of this type, in the given order.default Entity
Find an entity of this type by ID.findByIdOptional
(Id id) Find an entity of this type by ID.list
(String query, Parameters params) Find entities matching a query, with named parameters.list
(String query, Sort sort, Parameters params) Find entities matching a query and the given sort options, with named parameters.Find entities matching a query and the given sort options, with optional indexed parameters.Find entities matching a query and the given sort options, with named parameters.Find entities matching a query, with optional indexed parameters.Find entities matching a query, with named parameters.list
(org.bson.Document query) Find entities using a BSON query.list
(org.bson.Document query, org.bson.Document sort) Find entities using a BSON query and a BSON sort.listAll()
Find all entities of this type.Find all entities of this type, in the given order.default com.mongodb.client.MongoCollection<Entity>
Allow to access the underlying Mongo Collectiondefault com.mongodb.client.MongoDatabase
Allow to access the underlying Mongo Database.default void
Persist the given entity in the database.default void
Persist all given entities.default void
Persist all given entities.default void
Persist all given entities.default void
persistOrUpdate
(Entity entity) Persist the given entity in the database or update it if it already exists.default void
persistOrUpdate
(Entity firstEntity, Entity... entities) Persist all given entities or update them if they already exist.default void
persistOrUpdate
(Iterable<Entity> entities) Persist all given entities or update them if they already exist.default void
persistOrUpdate
(Stream<Entity> entities) Persist all given entities or update them if they already exist.stream
(String query, Parameters params) Find entities matching a query, with named parameters.stream
(String query, Sort sort, Parameters params) Find entities matching a query and the given sort options, with named parameters.Find entities matching a query and the given sort options, with optional indexed parameters.Find entities matching a query and the given sort options, with named parameters.Find entities matching a query, with optional indexed parameters.Find entities matching a query, with named parameters.stream
(org.bson.Document query) Find entities using a BSON query.stream
(org.bson.Document query, org.bson.Document sort) Find entities using a BSON query and a BSON sort.Find all entities of this type, in the given order.Find all entities of this type.default void
Update the given entity in the database.default void
Update all given entities.default void
Update all given entities.default PanacheUpdate
update
(String update, Parameters params) Update all entities of this type by the given update document, with named parameters.default PanacheUpdate
Update all entities of this type by the given update document, with optional indexed parameters.default PanacheUpdate
Update all entities of this type by the given update document, with named parameters.default void
Update all given entities.default PanacheUpdate
update
(org.bson.Document update) Update all entities of this type by the given update BSON document.
-
Method Details
-
persist
Persist the given entity in the database. This will set its ID field if not already set.- Parameters:
entity
- the entity to insert.- See Also:
-
update
Update the given entity in the database.- Parameters:
entity
- the entity to update.- See Also:
-
persistOrUpdate
Persist the given entity in the database or update it if it already exists.- Parameters:
entity
- the entity to update.- See Also:
-
delete
Delete the given entity from the database, if it is already persisted.- Parameters:
entity
- the entity to delete.- See Also:
-
findById
Find an entity of this type by ID.- Parameters:
id
- the ID of the entity to find.- Returns:
- the entity found, or
null
if not found.
-
findByIdOptional
Find an entity of this type by ID.- Parameters:
id
- the ID of the entity to find.- Returns:
- if found, an optional containing the entity, else
Optional.empty()
.
-
find
Find entities using a query, with optional indexed parameters.- Parameters:
query
- aquery string
params
- optional sequence of indexed parameters- Returns:
- a new
PanacheQuery
instance for the given query - See Also:
-
find
Find entities using a query and the given sort options, with optional indexed parameters.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
- optional sequence of indexed parameters- Returns:
- a new
PanacheQuery
instance for the given query - See Also:
-
find
Find entities using a query, with named parameters.- Parameters:
query
- aquery string
params
-Map
of named parameters- Returns:
- a new
PanacheQuery
instance for the given query - See Also:
-
find
@GenerateBridge default PanacheQuery<Entity> find(String query, Sort sort, Map<String, Object> params) Find entities using a query and the given sort options, with named parameters.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
-Map
of indexed parameters- Returns:
- a new
PanacheQuery
instance for the given query - See Also:
-
find
Find entities using a query, with named parameters.- Parameters:
query
- aquery string
params
-Parameters
of named parameters- Returns:
- a new
PanacheQuery
instance for the given query - See Also:
-
find
Find entities using a query and the given sort options, with named parameters.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
-Parameters
of indexed parameters- Returns:
- a new
PanacheQuery
instance for the given query - See Also:
-
find
Find entities using a BSON query.- Parameters:
query
- aDocument
query- Returns:
- a new
PanacheQuery
instance for the given query - See Also:
-
find
Find entities using a BSON query and a BSON sort.- Parameters:
query
- aDocument
querysort
- theDocument
sort- Returns:
- a new
PanacheQuery
instance for the given query - See Also:
-
findAll
Find all entities of this type.- Returns:
- a new
PanacheQuery
instance to find all entities of this type. - See Also:
-
findAll
Find all entities of this type, in the given order.- Parameters:
sort
- the sort order to use- Returns:
- a new
PanacheQuery
instance to find all entities of this type. - See Also:
-
list
Find entities matching a query, with optional indexed parameters. This method is a shortcut forfind(query, params).list()
.- Parameters:
query
- aquery string
params
- optional sequence of indexed parameters- Returns:
- a
List
containing all results, without paging - See Also:
-
list
Find entities matching a query and the given sort options, with optional indexed parameters. This method is a shortcut forfind(query, sort, params).list()
.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
- optional sequence of indexed parameters- Returns:
- a
List
containing all results, without paging - See Also:
-
list
Find entities matching a query, with named parameters. This method is a shortcut forfind(query, params).list()
.- Parameters:
query
- aquery string
params
-Map
of named parameters- Returns:
- a
List
containing all results, without paging - See Also:
-
list
Find entities matching a query and the given sort options, with named parameters. This method is a shortcut forfind(query, sort, params).list()
.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
-Map
of indexed parameters- Returns:
- a
List
containing all results, without paging - See Also:
-
list
Find entities matching a query, with named parameters. This method is a shortcut forfind(query, params).list()
.- Parameters:
query
- aquery string
params
-Parameters
of named parameters- Returns:
- a
List
containing all results, without paging - See Also:
-
list
Find entities matching a query and the given sort options, with named parameters. This method is a shortcut forfind(query, sort, params).list()
.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
-Parameters
of indexed parameters- Returns:
- a
List
containing all results, without paging - See Also:
-
list
Find entities using a BSON query. This method is a shortcut forfind(query).list()
.- Parameters:
query
- aDocument
query- Returns:
- a
List
containing all results, without paging - See Also:
-
list
Find entities using a BSON query and a BSON sort. This method is a shortcut forfind(query, sort).list()
.- Parameters:
query
- aDocument
querysort
- theDocument
sort- Returns:
- a
List
containing all results, without paging - See Also:
-
listAll
Find all entities of this type. This method is a shortcut forfindAll().list()
.- Returns:
- a
List
containing all results, without paging - See Also:
-
listAll
Find all entities of this type, in the given order. This method is a shortcut forfindAll(sort).list()
.- Parameters:
sort
- the sort order to use- Returns:
- a
List
containing all results, without paging - See Also:
-
stream
Find entities matching a query, with optional indexed parameters. This method is a shortcut forfind(query, params).stream()
.- Parameters:
query
- aquery string
params
- optional sequence of indexed parameters- Returns:
- a
Stream
containing all results, without paging - See Also:
-
stream
Find entities matching a query and the given sort options, with optional indexed parameters. This method is a shortcut forfind(query, sort, params).stream()
.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
- optional sequence of indexed parameters- Returns:
- a
Stream
containing all results, without paging - See Also:
-
stream
Find entities matching a query, with named parameters. This method is a shortcut forfind(query, params).stream()
.- Parameters:
query
- aquery string
params
-Map
of named parameters- Returns:
- a
Stream
containing all results, without paging - See Also:
-
stream
Find entities matching a query and the given sort options, with named parameters. This method is a shortcut forfind(query, sort, params).stream()
.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
-Map
of indexed parameters- Returns:
- a
Stream
containing all results, without paging - See Also:
-
stream
Find entities matching a query, with named parameters. This method is a shortcut forfind(query, params).stream()
.- Parameters:
query
- aquery string
params
-Parameters
of named parameters- Returns:
- a
Stream
containing all results, without paging - See Also:
-
stream
Find entities matching a query and the given sort options, with named parameters. This method is a shortcut forfind(query, sort, params).stream()
.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
-Parameters
of indexed parameters- Returns:
- a
Stream
containing all results, without paging - See Also:
-
stream
Find entities using a BSON query. This method is a shortcut forfind(query).stream()
.- Parameters:
query
- aDocument
query- Returns:
- a
Stream
containing all results, without paging - See Also:
-
stream
Find entities using a BSON query and a BSON sort. This method is a shortcut forfind(query, sort).stream()
.- Parameters:
query
- aDocument
querysort
- theDocument
sort- Returns:
- a
Stream
containing all results, without paging - See Also:
-
streamAll
Find all entities of this type. This method is a shortcut forfindAll().stream()
.- Returns:
- a
Stream
containing all results, without paging - See Also:
-
streamAll
Find all entities of this type, in the given order. This method is a shortcut forfindAll(sort).stream()
.- Returns:
- a
Stream
containing all results, without paging - See Also:
-
count
Counts the number of this type of entity in the database.- Returns:
- the number of this type of entity in the database.
- See Also:
-
count
Counts the number of this type of entity matching the given query, with optional indexed parameters.- Parameters:
query
- aquery string
params
- optional sequence of indexed parameters- Returns:
- the number of entities counted.
- See Also:
-
count
Counts the number of this type of entity matching the given query, with named parameters.- Parameters:
query
- aquery string
params
-Map
of named parameters- Returns:
- the number of entities counted.
- See Also:
-
count
Counts the number of this type of entity matching the given query, with named parameters.- Parameters:
query
- aquery string
params
-Parameters
of named parameters- Returns:
- the number of entities counted.
- See Also:
-
count
Counts the number of this type of entity matching the given query- Parameters:
query
- aDocument
query- Returns:
- he number of entities counted.
- See Also:
-
deleteAll
Delete all entities of this type from the database.- Returns:
- the number of entities deleted.
- See Also:
-
deleteById
Delete an entity of this type by ID.- Parameters:
id
- the ID of the entity to delete.- Returns:
- false if the entity was not deleted (not found).
-
delete
Delete all entities of this type matching the given query, with optional indexed parameters.- Parameters:
query
- aquery string
params
- optional sequence of indexed parameters- Returns:
- the number of entities deleted.
- See Also:
-
delete
Delete all entities of this type matching the given query, with named parameters.- Parameters:
query
- aquery string
params
-Map
of named parameters- Returns:
- the number of entities deleted.
- See Also:
-
delete
Delete all entities of this type matching the given query, with named parameters.- Parameters:
query
- aquery string
params
-Parameters
of named parameters- Returns:
- the number of entities deleted.
- See Also:
-
delete
Delete all entities of this type matching the given query- Parameters:
query
- aDocument
query- Returns:
- he number of entities counted.
- See Also:
-
persist
Persist all given entities.- Parameters:
entities
- the entities to insert- See Also:
-
persist
Persist all given entities.- Parameters:
entities
- the entities to insert- See Also:
-
persist
Persist all given entities.- Parameters:
entities
- the entities to insert- See Also:
-
update
Update all given entities.- Parameters:
entities
- the entities to update- See Also:
-
update
Update all given entities.- Parameters:
entities
- the entities to update- See Also:
-
update
Update all given entities.- Parameters:
entities
- the entities to update- See Also:
-
persistOrUpdate
Persist all given entities or update them if they already exist.- Parameters:
entities
- the entities to update- See Also:
-
persistOrUpdate
Persist all given entities or update them if they already exist.- Parameters:
entities
- the entities to update- See Also:
-
persistOrUpdate
Persist all given entities or update them if they already exist.- Parameters:
entities
- the entities to update- See Also:
-
update
Update all entities of this type by the given update document, with optional indexed parameters. The returnedPanacheUpdate
object will allow to restrict on which documents the update should be applied.- Parameters:
update
- the update document, if it didn't contain any update operator, we add$set
. It can also be expressed as aquery string
.params
- optional sequence of indexed parameters- Returns:
- a new
PanacheUpdate
instance for the given update document - See Also:
-
update
Update all entities of this type by the given update document, with named parameters. The returnedPanacheUpdate
object will allow to restrict on which documents the update should be applied.- Parameters:
update
- the update document, if it didn't contain any update operator, we add$set
. It can also be expressed as aquery string
.params
-Map
of named parameters- Returns:
- a new
PanacheUpdate
instance for the given update document - See Also:
-
update
Update all entities of this type by the given update document, with named parameters. The returnedPanacheUpdate
object will allow to restrict on which document the update should be applied.- Parameters:
update
- the update document, if it didn't contain any update operator, we add$set
. It can also be expressed as aquery string
.params
-Parameters
of named parameters- Returns:
- a new
PanacheUpdate
instance for the given update document - See Also:
-
update
Update all entities of this type by the given update BSON document. The returnedPanacheUpdate
object will allow to restrict on which document the update should be applied.- Parameters:
update
- the update document, as aDocument
.- Returns:
- a new
PanacheUpdate
instance for the given update document - See Also:
-
mongoCollection
Allow to access the underlying Mongo Collection -
mongoDatabase
Allow to access the underlying Mongo Database.
-