Interface MongoDBTemplate

All Superinterfaces:
org.eclipse.jnosql.mapping.document.DocumentTemplate, org.eclipse.jnosql.mapping.semistructured.SemiStructuredTemplate, jakarta.nosql.Template

public interface MongoDBTemplate extends org.eclipse.jnosql.mapping.document.DocumentTemplate
A MongoDB extension of DocumentTemplate
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> Stream<T>
    aggregate(Class<T> entity, List<org.bson.conversions.Bson> pipeline)
    Aggregates documents according to the specified aggregation pipeline.
    <T> Stream<Map<String,org.bson.BsonValue>>
    aggregate(Class<T> entity, org.bson.conversions.Bson... pipeline)
    Aggregates documents according to the specified aggregation pipeline.
    <T> Stream<T>
    aggregate(String collectionName, List<org.bson.conversions.Bson> pipeline)
    Aggregates documents according to the specified aggregation pipeline.
    Stream<Map<String,org.bson.BsonValue>>
    aggregate(String collectionName, org.bson.conversions.Bson... pipeline)
    Aggregates documents according to the specified aggregation pipeline.
    <T> long
    count(Class<T> entity, org.bson.conversions.Bson filter)
    Returns the number of items in the collection that match the given query filter.
    long
    count(String collectionName, org.bson.conversions.Bson filter)
    Returns the number of items in the collection that match the given query filter.
    <T> long
    delete(Class<T> entity, org.bson.conversions.Bson filter)
    Removes all documents from the collection that match the given query filter.
    long
    delete(String collectionName, org.bson.conversions.Bson filter)
    Removes all documents from the collection that match the given query filter.
    <T> Stream<T>
    select(Class<T> entity, org.bson.conversions.Bson filter)
    Finds all documents in the collection.
    <T> Stream<T>
    select(String collectionName, org.bson.conversions.Bson filter)
    Finds all documents in the collection.

    Methods inherited from interface org.eclipse.jnosql.mapping.semistructured.SemiStructuredTemplate

    count, count, count, delete, deleteAll, exists, findAll, prepare, prepare, query, query, select, selectCursor, selectOffSet, singleResult, singleResult, singleResult

    Methods inherited from interface jakarta.nosql.Template

    delete, delete, find, insert, insert, insert, insert, select, update, update
  • Method Details

    • delete

      long delete(String collectionName, org.bson.conversions.Bson filter)
      Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
      Parameters:
      collectionName - the collection name
      filter - the delete filter
      Returns:
      the number of documents deleted.
      Throws:
      NullPointerException - when filter or collectionName is null
    • delete

      <T> long delete(Class<T> entity, org.bson.conversions.Bson filter)
      Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
      Type Parameters:
      T - the entity type
      Parameters:
      entity - the entity to take the collection name
      filter - the delete filter
      Returns:
      the number of documents deleted.
      Throws:
      NullPointerException - when there is any null parameter
    • select

      <T> Stream<T> select(String collectionName, org.bson.conversions.Bson filter)
      Finds all documents in the collection.
      Type Parameters:
      T - the entity type
      Parameters:
      collectionName - the collection name
      filter - the query filter
      Returns:
      the stream result
      Throws:
      NullPointerException - when filter or collectionName is null
    • select

      <T> Stream<T> select(Class<T> entity, org.bson.conversions.Bson filter)
      Finds all documents in the collection.
      Type Parameters:
      T - the entity type
      Parameters:
      entity - the collection name
      filter - the query filter
      Returns:
      the stream result
      Throws:
      NullPointerException - when filter or entity is null
    • aggregate

      Stream<Map<String,org.bson.BsonValue>> aggregate(String collectionName, org.bson.conversions.Bson... pipeline)
      Aggregates documents according to the specified aggregation pipeline.
      Parameters:
      collectionName - the collection name
      pipeline - the aggregation pipeline
      Returns:
      the stream result
      Throws:
      NullPointerException - when pipeline or collectionName is null
    • aggregate

      <T> Stream<Map<String,org.bson.BsonValue>> aggregate(Class<T> entity, org.bson.conversions.Bson... pipeline)
      Aggregates documents according to the specified aggregation pipeline.
      Type Parameters:
      T - the entity type
      Parameters:
      entity - the collection name
      pipeline - the aggregation pipeline
      Returns:
      the stream result
      Throws:
      NullPointerException - when pipeline or entity is null
    • aggregate

      <T> Stream<T> aggregate(Class<T> entity, List<org.bson.conversions.Bson> pipeline)
      Aggregates documents according to the specified aggregation pipeline.
      Type Parameters:
      T - the entity type
      Parameters:
      entity - the collection name
      pipeline - the aggregation pipeline
      Returns:
      the stream result
      Throws:
      NullPointerException - when pipeline or entity is null
    • aggregate

      <T> Stream<T> aggregate(String collectionName, List<org.bson.conversions.Bson> pipeline)
      Aggregates documents according to the specified aggregation pipeline.
      Type Parameters:
      T - the entity type
      Parameters:
      collectionName - the collection name
      pipeline - the aggregation pipeline
      Returns:
      the stream result
      Throws:
      NullPointerException - when pipeline or collectionName is null
    • count

      long count(String collectionName, org.bson.conversions.Bson filter)
      Returns the number of items in the collection that match the given query filter.
      Parameters:
      collectionName - the collection name
      filter - the query
      Returns:
      the number of documents founded.
      Throws:
      NullPointerException - when filter or collectionName is null
    • count

      <T> long count(Class<T> entity, org.bson.conversions.Bson filter)
      Returns the number of items in the collection that match the given query filter.
      Parameters:
      entity - the entity type
      filter - the filter
      Returns:
      the number of documents founded.
      Throws:
      NullPointerException - when filter or collectionName is null