title: Check for missing field or null value in mongoDB atlas
body: <p>I am using mongodb atlas for full text search.
  My sample collection looks like this :</p>
  <pre><code>{
    &quot;_id&quot;: &quot;62fdfd7518da050007f035c5&quot;,
    &quot;expiryDate&quot;: &quot;2022-08-18T23:59:59+05:30&quot;,
    &quot;arrayField&quot; : ['abc', 'def', 'ghi', 'jkl']
  },
  {
    &quot;_id&quot;: &quot;62fdfd7518da050007f035c6&quot;,
    &quot;expiryDate&quot;: null,
    &quot;arrayField&quot; : ['abc','jkl']
  },
  {
    &quot;_id&quot;: &quot;62fdfd7518da050007f035c7&quot;,
    &quot;arrayField&quot; : []
  },
  {
    &quot;_id&quot;: &quot;62fdfd7518da050007f035c8&quot;,
    &quot;expiryDate&quot;: null
  }
  </code></pre>
  <p><code>expiryDate</code> is a <code>Date</code> type field and <code>arrayField</code> is an <code>Array</code> type field.</p>
  <p>My goal is to get all documents where either :</p>
  <ol>
  <li><code>expiryDate</code> doesn't exists OR</li>
  <li>If <code>expiryDate</code> does exists, then it must be null OR</li>
  <li>If <code>expiryDate</code> does exists, then it must greater than current time.</li>
  </ol>
  <p>My current atlas aggregation looks like :</p>
  <pre><code>{
      'compound' : {
          'should' : [
              {
                  'compound' : {
                      'mustNot' : [{
                          &quot;exists&quot;: {
                              &quot;path&quot;: &quot;expiryDate&quot;,
                          }
                      }]
                  }
              },
              {
                  &quot;range&quot;: {
                      &quot;path&quot;: &quot;expiryDate&quot;,
                      'gte': new Date()
                  }
              }
          ],
          'minimumShouldMatch' : 1
      }
  }
  </code></pre>
  <p>This is not returning all documents where the <code>expiryDate</code> field have <code>null</code> value and it is only matching one clause of should where <code>expiryDate</code> is greater than or equal to current time. I want it to return all those documents too where the <code>expiryDate</code> is <code>null</code>.</p>
  <p>Please advise.</p>