title: How to add default query criteria for all the queries when using method queries in spring boot mongodb
body: <p>I have a requirement to execute method queries against a given mongo database and retrieve data. But for that, I have to check whether the field <code>delete=false</code>(Soft delete) for taking them for all the queries.</p>
  <p>It can be achieved by the following kind of query</p>
  <p>eg: <code>Optional&lt;User&gt; findByIdAndDeletedIsFalse(String id);</code></p>
  <p>But as you can see we have to put <code>DeletedIsFalse</code> for all the queries.
  I tried the answer provided in <a href="https://stackoverflow.com/questions/67516405/how-to-add-default-criteria-to-all-the-queries-by-default-in-mongo-spring-boot">How to add default criteria to all the queries by default in mongo spring boot</a> but I could find out that it can be only used then we are running queries directly using the mongo template.</p>
  <p>After some debugging, I could find out that even though method queries are executed through the Mogno template, they are using package-protected classes and methods to do it. So they cannot be overridden by an inherited class.
  I cannot find an entry point for them to executed and where to inject default criteria for the method queries.</p>
  <p>Eg: If we check the implementation of <code>MongoTemple</code>, at the end the execution is happening through a method</p>
  <pre class="lang-java prettyprint-override"><code>&lt;S, T&gt; List&lt;T&gt; doFind(String collectionName, Document query, Document fields, Class&lt;S&gt; sourceClass, Class&lt;T&gt; targetClass, CursorPreparer preparer)
  </code></pre>
  <p>and that method is invoked from an internal class called <code>ExecutableFindOperationSupport</code>. All those classes are package protected.</p>
  <p>Is there any reason to make them package protected and not giving the chance to override them from an inherited class?
  Also is there any other way of running method queries with default criteria without appending them to all the queries?</p>