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 TypeMethodDescription<T> Stream<T>Aggregates documents according to the specified aggregation pipeline.Aggregates documents according to the specified aggregation pipeline.<T> Stream<T>Aggregates documents according to the specified aggregation pipeline.Aggregates documents according to the specified aggregation pipeline.<T> longReturns the number of items in the collection that match the given query filter.longReturns the number of items in the collection that match the given query filter.<T> longRemoves all documents from the collection that match the given query filter.longRemoves all documents from the collection that match the given query filter.<T> Stream<T>Finds all documents in the collection.<T> Stream<T>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, singleResultMethods inherited from interface jakarta.nosql.Template
delete, delete, find, insert, insert, insert, insert, select, update, update
-
Method Details
-
delete
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 namefilter- the delete filter- Returns:
- the number of documents deleted.
- Throws:
NullPointerException- when filter or collectionName is null
-
delete
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 namefilter- the delete filter- Returns:
- the number of documents deleted.
- Throws:
NullPointerException- when there is any null parameter
-
select
Finds all documents in the collection.- Type Parameters:
T- the entity type- Parameters:
collectionName- the collection namefilter- the query filter- Returns:
- the stream result
- Throws:
NullPointerException- when filter or collectionName is null
-
select
Finds all documents in the collection.- Type Parameters:
T- the entity type- Parameters:
entity- the collection namefilter- 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 namepipeline- 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 namepipeline- the aggregation pipeline- Returns:
- the stream result
- Throws:
NullPointerException- when pipeline or entity is null
-
aggregate
Aggregates documents according to the specified aggregation pipeline.- Type Parameters:
T- the entity type- Parameters:
entity- the collection namepipeline- the aggregation pipeline- Returns:
- the stream result
- Throws:
NullPointerException- when pipeline or entity is null
-
aggregate
Aggregates documents according to the specified aggregation pipeline.- Type Parameters:
T- the entity type- Parameters:
collectionName- the collection namepipeline- the aggregation pipeline- Returns:
- the stream result
- Throws:
NullPointerException- when pipeline or collectionName is null
-
count
Returns the number of items in the collection that match the given query filter.- Parameters:
collectionName- the collection namefilter- the query- Returns:
- the number of documents founded.
- Throws:
NullPointerException- when filter or collectionName is null
-
count
Returns the number of items in the collection that match the given query filter.- Parameters:
entity- the entity typefilter- the filter- Returns:
- the number of documents founded.
- Throws:
NullPointerException- when filter or collectionName is null
-