title: How to pass variable inside method of MongoDB
body: <p>I need to pass a variable to MongoDB query inside of the method, but I got the following errors:</p>
  <pre><code>org.bson.json.JsonParseException: JSON reader expected a string but found '?0'.
  </code></pre>
  <p><strong>Query</strong>:</p>
  <pre><code>@Query(value = &quot;{ $and: [ {'created_at': {$lt: ISODate(?0)} } ] }&quot;)
  Stream&lt;MyObject&gt; findByCreatedAt(Instant createdAtTimeInterval);
  </code></pre>
  <p><strong>Calling repository</strong>:</p>
  <pre><code>Instant nowTime = Instant.now();
  myObjectRepo.findByCreatedAt( nowTime.minus( Duration.ofHours(2) ) );
  </code></pre>
  <p>Please help me how is the best way of the current condition.</p>