Skip to content

Commit 1ea0b28

Browse files
committed
feat: add count with bson query filter
Signed-off-by: Maximillian Arruda <[email protected]>
1 parent 16d2e03 commit 1ea0b28

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

jnosql-mongodb/src/main/java/org/eclipse/jnosql/databases/mongodb/mapping/MongoDBTemplate.java

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,31 @@ public interface MongoDBTemplate extends JNoSQLDocumentTemplate {
8888
/**
8989
* Aggregates documents according to the specified aggregation pipeline.
9090
*
91-
* @param entity the collection name
92-
* @param <T> the entity type
93-
* @param pipeline the aggregation pipeline
91+
* @param entity the collection name
92+
* @param <T> the entity type
93+
* @param pipeline the aggregation pipeline
9494
* @return the number of documents deleted.
9595
* @throws NullPointerException when filter or entity is null
9696
*/
9797
<T> Stream<Map<String, BsonValue>> aggregate(Class<T> entity, List<Bson> pipeline);
98-
98+
99+
/**
100+
* Returns the number of items in the collection that match the given query filter.
101+
*
102+
* @param collectionName the collection name
103+
* @param filter the query
104+
* @return the number of documents founded.
105+
* @throws NullPointerException when filter or collectionName is null
106+
*/
107+
long count(String collectionName, Bson filter);
108+
109+
/**
110+
* Returns the number of items in the collection that match the given query filter.
111+
*
112+
* @param entity the collection name
113+
* @param filter the filter
114+
* @return the number of documents founded.
115+
* @throws NullPointerException when filter or collectionName is null
116+
*/
117+
<T> long count(Class<T> entity, Bson filter);
99118
}

0 commit comments

Comments
 (0)