The @Query
annotation makes it possible to specify a MongoDB query for a particular method. An example might be @Query("{ 'firstname' : ?0 }")
. But what should the parameter to @Query
be if I just want to find all documents without specifying a "where" clause? The code below illustrates what I'm trying to achieve but perhaps the question is simply: what is the JSON/BSON query to fetch all documents?
@NoRepositoryBean
public interface QuoteRepository {
public QuoteProvider findByName(String name);
public List<QuoteProvider> findAllQuoteProviders();
}
@Repository
public interface MongoQuoteRepository extends QuoteRepository, MongoRepository<QuoteProvider, String> {
@Query("findAll") // What should this be?
@Override
public List<QuoteProvider> findAllQuoteProviders();
}