How to use mongodb in query in spring data @Query annotation

Viewed 87

In my project I am trying to execute mongodb in using spring data @Query annotation as follows.

@Query("{'employerId' : ?0,  'state' : { $in: ?1 } ")
Page<T> findByEmployerIdAndStates(Pageable pageable, String employerId, final List<String> states);

With this i'm trying to execute query like below

{'employerId' : '367bdb30-e42b-4269-95e3-3c95e236c3da', 'state' : { $in: ['abc','test']}}

However I'm getting empty data set from spring repository even though query has data. Is above correct ? I could not found sample on this.

0 Answers
Related