@@ -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