0

I have query like this

@Query(value = "{'statusHistories':{$elemMatch:{'status':{$in:['PROCESSABLE']}}},'created' : { '$gt' : { '$date' : ':#{#dateFrom}' } , '$lt' : { '$date' : ':dateTo'}}}", count = true)
    Long countMe(@Param("dateFrom") Date datefrom, @Param("dateTo") Date dateTo);

How can I inject dateFrom and DateTo to params of query ? I've tried different combinations :dateFrom etc

Pete
  • 57,112
  • 28
  • 117
  • 166
Przemek85
  • 171
  • 1
  • 1
  • 10

1 Answers1

0

You have to access by position like :?0 and 0 being the position of the parameter in the method.

@Query(value = "{'statusHistories':{$elemMatch:{'status':{$in:['PROCESSABLE']}}},'created' : { '$gt' : { '$date' : ':?0' } , '$lt' : { '$date' : ':?1'}}}", count = true)
Long countMe(@Param("dateFrom") Date datefrom, @Param("dateTo") Date dateTo);
titogeo
  • 2,156
  • 2
  • 24
  • 41