title: mongodb atlas online archive custom criteria
body: <p>I'm trying to create a custom criteria query, the issue is that mongo requires it to be a json document and it then translate it to a query</p>
  <p>i want this to be the query <code>db.reports.find({ &quot;time_lo_res&quot;: { $lte: NumberLong(ISODate().getTime() - 1000 * 3600 * 24 * 30)}}, { &quot;category&quot;: &quot;user&quot; }).sort({ &quot;time_lo_res&quot;: 1 })</code>
  i.e. get all the docs that have time_lo_res older then 30 days and the category is user, then sort them ascending.</p>
  <p>i managed to get this</p>
  <pre><code>  &quot;time_lo_res&quot;: {
      &quot;$lte&quot;: &quot;NumberLong(ISODate().getTime() - 1000 * 3600 * 24 * 30)&quot;
    },
    &quot;category&quot;: {
      &quot;$eq&quot;: &quot;user&quot;
    }
  }
  </code></pre>
  <p>which is missing the sort part, can't figure out how to add it, also not sure if the quotes around the arguments doesn't break the query, they are required since it require a valid json</p>
  <p>will really appreciate any help</p>