I'm working with Spring Boot and MondoDB. My project is growing up, and I'm trying to make complex queries. Working with 'MongoRepository' I tryed to make the following query:
@Query("{$match:{'_id':?0}},{$unwind:'$menuOptions'},{$match:{'menuOptions.active':'true'}},{$unwind:'$menuOptions.menuSubOptions'},{$match:{'menuOptions.menuSubOptions.active':'true'}}")
Roles findMenu(String name);
With the following result:
Caused by: com.mongodb.MongoException: Can't canonicalize query: BadValue unknown top level operator: $match
I've been trying to make another queries (for instance, a $sort/$orderby with the '@Query' annotation with the same result. Any idea?