I want to create method to count all documents in collection using @query
For example
@query("db.collection.count()")
Long countAllDocuments;
I want to create method to count all documents in collection using @query
For example
@query("db.collection.count()")
Long countAllDocuments;
I think the folowing code should hep you :
@Query(value = "{}", count = true)
public Long countAllDocuments();
Similar issue : Count in Spring Data MongoDB repository