Search code examples
grailsgroovyspring-datafindbymongorepository

Mongo repository findby with collection - Groovy


I am working on an application made with Groovy and Spring data. Mongo is the database. I have the following class structure:

Class A {
  String name;
  List<B> priorities;
}

The objects of class A are persisted into mongo. Now, I want to query for all the object which have not null and not blank priorities. I tried with following method:

findByPrioritiesNotNull()

However, it is not working. It throws an error saying no such method. Can anyone please help?


Solution

  • findByPrioritiesIsNotNull() is the correct spelling