Package 

Interface PanacheMongoRepositoryBase

  • All Implemented Interfaces:

    
    public interface PanacheMongoRepositoryBase<Entity extends Object, Id extends Object>
    
                        

    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.

    • Constructor Detail

    • Method Detail

      • persist

         Unit persist(Entity entity)

        Persist the given entity in the database. This will set it's ID field if not already set.

        Parameters:
        entity - the entity to insert.
      • persist

         Unit persist(Stream<Entity> entities)

        Persist all given entities.

        Parameters:
        entities - the entities to insert
      • persist

         Unit persist(Entity firstEntity, Entity entities)

        Persist all given entities.

        Parameters:
        entities - the entities to insert
      • update

         Unit update(Entity entity)

        Update the given entity in the database.

        Parameters:
        entity - the entity to update.
      • update

         Unit update(Iterable<Entity> entities)

        Update all given entities.

        Parameters:
        entities - the entities to update
      • update

         Unit update(Stream<Entity> entities)

        Update all given entities.

        Parameters:
        entities - the entities to update
      • update

         Unit update(Entity firstEntity, Entity entities)

        Update all given entities.

        Parameters:
        entities - the entities to update
      • update

         PanacheUpdate update(String update, Object params)

        Update all entities of this type by the given update document, with optional indexed parameters. The returned io.quarkus.mongodb.panache.common.PanacheUpdate 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.
        params - optional sequence of indexed parameters
      • update

         PanacheUpdate update(String update, Map<String, Object> params)

        Update all entities of this type by the given update document, with named parameters. The returned io.quarkus.mongodb.panache.common.PanacheUpdate 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.
        params - Map of named parameters
      • update

         PanacheUpdate update(String update, Parameters params)

        Update all entities of this type by the given update document, with named parameters. The returned io.quarkus.mongodb.panache.common.PanacheUpdate 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.
        params - Parameters of named parameters
      • update

         PanacheUpdate update(Document update)

        Update all entities of this type by the given update BSON document. The returned io.quarkus.mongodb.panache.common.PanacheUpdate object will allow to restrict on which document the update should be applied.

        Parameters:
        update - the update document, as a Document.
      • persistOrUpdate

         Unit persistOrUpdate(Entity entity)

        Persist the given entity in the database or update it if it already exist.

        Parameters:
        entity - the entity to update.
      • persistOrUpdate

         Unit persistOrUpdate(Iterable<Entity> entities)

        Persist all given entities or update them if they already exist.

        Parameters:
        entities - the entities to update
      • persistOrUpdate

         Unit persistOrUpdate(Stream<Entity> entities)

        Persist all given entities or update them if they already exist.

        Parameters:
        entities - the entities to update
      • persistOrUpdate

         Unit persistOrUpdate(Entity firstEntity, Entity entities)

        Persist all given entities or update them if they already exist.

        Parameters:
        entities - the entities to update
      • delete

         Unit delete(Entity entity)

        Delete the given entity from the database, if it is already persisted.

        Parameters:
        entity - the entity to delete.
      • delete

         Long delete(String query, Object params)

        Delete all entities of this type matching the given query, with optional indexed parameters.

        Parameters:
        query - a query string
        params - optional sequence of indexed parameters
      • delete

         Long delete(String query, Map<String, Object> params)

        Delete all entities of this type matching the given query, with named parameters.

        Parameters:
        query - a query string
        params - Map of named parameters
      • delete

         Long delete(String query, Parameters params)

        Delete all entities of this type matching the given query, with named parameters.

        Parameters:
        query - a query string
        params - Parameters of named parameters
      • delete

         Long delete(Document query)

        Delete all entities of this type matching the given query

        Parameters:
        query - a Document query
      • findById

         Entity findById(Id id)

        Find an entity of this type by ID.

        Parameters:
        id - the ID of the entity to find.
      • find

         PanacheQuery<Entity> find(String query, Object params)

        Find entities using a query, with optional indexed parameters.

        Parameters:
        query - a query string
        params - optional sequence of indexed parameters
      • find

         PanacheQuery<Entity> find(String query, Sort sort, Object params)

        Find entities using a query and the given sort options, with optional indexed parameters.

        Parameters:
        query - a query string
        sort - the sort strategy to use
        params - optional sequence of indexed parameters
      • find

         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 - a query string
        sort - the sort strategy to use
        params - Map of indexed parameters
      • find

         PanacheQuery<Entity> find(String query, Parameters params)

        Find entities using a query, with named parameters.

        Parameters:
        query - a query string
        params - Parameters of named parameters
      • find

         PanacheQuery<Entity> find(String query, Sort sort, Parameters params)

        Find entities using a query and the given sort options, with named parameters.

        Parameters:
        query - a query string
        sort - the sort strategy to use
        params - Parameters of indexed parameters
      • find

         PanacheQuery<Entity> find(Document query)

        Find entities using a BSON query.

        Parameters:
        query - a Document query
      • find

         PanacheQuery<Entity> find(Document query, Document sort)

        Find entities using a BSON query and a BSON sort.

        Parameters:
        query - a Document query
        sort - the Document sort
      • findAll

         PanacheQuery<Entity> findAll(Sort sort)

        Find all entities of this type, in the given order.

        Parameters:
        sort - the sort order to use
      • list

         List<Entity> list(String query, Object params)

        Find entities matching a query, with optional indexed parameters. This method is a shortcut for find(query, params).list().

        Parameters:
        query - a query string
        params - optional sequence of indexed parameters
      • list

         List<Entity> list(String query, Sort sort, Object params)

        Find entities matching a query and the given sort options, with optional indexed parameters. This method is a shortcut for find(query, sort, params).list().

        Parameters:
        query - a query string
        sort - the sort strategy to use
        params - optional sequence of indexed parameters
      • list

         List<Entity> list(String query, Map<String, Object> params)

        Find entities matching a query, with named parameters. This method is a shortcut for find(query, params).list().

        Parameters:
        query - a query string
        params - Map of named parameters
      • list

         List<Entity> list(String query, Sort sort, Map<String, Object> params)

        Find entities matching a query and the given sort options, with named parameters. This method is a shortcut for find(query, sort, params).list().

        Parameters:
        query - a query string
        sort - the sort strategy to use
        params - Map of indexed parameters
      • list

         List<Entity> list(String query, Parameters params)

        Find entities matching a query, with named parameters. This method is a shortcut for find(query, params).list().

        Parameters:
        query - a query string
        params - Parameters of named parameters
      • list

         List<Entity> list(String query, Sort sort, Parameters params)

        Find entities matching a query and the given sort options, with named parameters. This method is a shortcut for find(query, sort, params).list().

        Parameters:
        query - a query string
        sort - the sort strategy to use
        params - Parameters of indexed parameters
      • list

         List<Entity> list(Document query)

        Find entities using a BSON query. This method is a shortcut for find(query).list().

        Parameters:
        query - a Document query
      • list

         List<Entity> list(Document query, Document sort)

        Find entities using a BSON query and a BSON sort. This method is a shortcut for find(query, sort).list().

        Parameters:
        query - a Document query
        sort - the Document sort
      • listAll

         List<Entity> listAll()

        Find all entities of this type. This method is a shortcut for findAll().list().

      • listAll

         List<Entity> listAll(Sort sort)

        Find all entities of this type, in the given order. This method is a shortcut for findAll(sort).list().

        Parameters:
        sort - the sort order to use
      • stream

         Stream<Entity> stream(String query, Object params)

        Find entities matching a query, with optional indexed parameters. This method is a shortcut for find(query, params).stream().

        Parameters:
        query - a query string
        params - optional sequence of indexed parameters
      • stream

         Stream<Entity> stream(String query, Sort sort, Object params)

        Find entities matching a query and the given sort options, with optional indexed parameters. This method is a shortcut for find(query, sort, params).stream().

        Parameters:
        query - a query string
        sort - the sort strategy to use
        params - optional sequence of indexed parameters
      • stream

         Stream<Entity> stream(String query, Map<String, Object> params)

        Find entities matching a query, with named parameters. This method is a shortcut for find(query, params).stream().

        Parameters:
        query - a query string
        params - Map of named parameters
      • stream

         Stream<Entity> stream(String query, Sort sort, Map<String, Object> params)

        Find entities matching a query and the given sort options, with named parameters. This method is a shortcut for find(query, sort, params).stream().

        Parameters:
        query - a query string
        sort - the sort strategy to use
        params - Map of indexed parameters
      • stream

         Stream<Entity> stream(String query, Parameters params)

        Find entities matching a query, with named parameters. This method is a shortcut for find(query, params).stream().

        Parameters:
        query - a query string
        params - Parameters of named parameters
      • stream

         Stream<Entity> stream(String query, Sort sort, Parameters params)

        Find entities matching a query and the given sort options, with named parameters. This method is a shortcut for find(query, sort, params).stream().

        Parameters:
        query - a query string
        sort - the sort strategy to use
        params - Parameters of indexed parameters
      • stream

         Stream<Entity> stream(Document query)

        Find entities using a BSON query. This method is a shortcut for find(query).stream().

        Parameters:
        query - a Document query
      • stream

         Stream<Entity> stream(Document query, Document sort)

        Find entities using a BSON query and a BSON sort. This method is a shortcut for find(query, sort).stream().

        Parameters:
        query - a Document query
        sort - the Document sort
      • streamAll

         Stream<Entity> streamAll(Sort sort)

        Find all entities of this type. This method is a shortcut for findAll().stream().

      • streamAll

         Stream<Entity> streamAll()

        Find all entities of this type, in the given order. This method is a shortcut for findAll(sort).stream().

      • count

         Long count()

        Counts the number of this type of entity in the database.

      • count

         Long count(String query, Object params)

        Counts the number of this type of entity matching the given query, with optional indexed parameters.

        Parameters:
        query - a query string
        params - optional sequence of indexed parameters
      • count

         Long count(String query, Map<String, Object> params)

        Counts the number of this type of entity matching the given query, with named parameters.

        Parameters:
        query - a query string
        params - Map of named parameters
      • count

         Long count(String query, Parameters params)

        Counts the number of this type of entity matching the given query, with named parameters.

        Parameters:
        query - a query string
        params - Parameters of named parameters
      • count

         Long count(Document query)

        Counts the number of this type of entity matching the given query

        Parameters:
        query - a Document query
      • deleteAll

         Long deleteAll()

        Delete all entities of this type from the database.

      • deleteById

         Boolean deleteById(Id id)

        Delete an entity of this type by ID.

        Parameters:
        id - the ID of the entity to delete.
      • mongoCollection

         MongoCollection<Entity> mongoCollection()

        Allow to access the underlying Mongo Collection

      • mongoDatabase

         MongoDatabase mongoDatabase()

        Allow to access the underlying Mongo Database.