title: Spring Data Mongodb optional parameter with between dates
body: <p>I am trying to create json query with three optional field in spring data mongodb.</p>
  
  <ol>
  <li>status</li>
  <li><p>startdate and enddate for between. Below is the query i have created but this is failing. its failing with json parsing error, I am not sure what is wrong</p>
  
  <p>@Query("{$and: [{$or : [ { $where: '?0 == null' } , { status : ?0 } ]}, {$or : [ { $where: '?1 == null' , $where: '?2 == null' } , { createdDate : {$gt : ?1, $lt : ?2}} ]}]}")</p></li>
  </ol>
  
  <p>Can anyone please let me know what is wrong and help me to create the query with these optional parameters ?</p>