title: How to write a query to get all documents where field doesn't matches
body: <p>I am having some trouble writing a query where I want to get all documents where they don't have a single subdocument where its property <code>IsCurrentRevision</code> is true. In other words, only getting documents that don't have a single revision marked as current. </p>
  
  <p>What I have so far is: </p>
  
  <pre><code>{StartTimeUtc: {$gte: new ISODate('12/14/2019')}, 
  EndTimeUtc: {$lte: new ISODate('01/21/2020')}, 
  IsDeleted: false, 'MyDocument.IsCurrentRevision': false, 
  "MyDocument.1.IsCurrentRevision" : {$exists: false}}
  </code></pre>
  
  <p>This gets me somewhere, but the issue is that I have to manually query the index. In this case, the above query returns all documents with only 1 revision (so only one element in the sub document array), that doesn't  have its revision marked as current. Thus if I wanted to get documents that have 2 revisions, with the second one marked as false as well I would need to update the query to be: </p>
  
  <pre><code>{StartTimeUtc: {$gte: new ISODate('12/14/2019')}, 
  EndTimeUtc: {$lte: new ISODate('01/21/2020')}, 
  IsDeleted: false, 'MyDocument.1.IsCurrentRevision': false, 
  "MyDocument.2.IsCurrentRevision" : {$exists: false}}
  </code></pre>
  
  <p>This is obviously tedious, is there a better way? If it helps, I am using Mongo Compass </p>
  
  <p>Edit:</p>
  
  <p>Here is how my document looks like </p>
  
  <pre><code>{
    _id: Guid,
    TemplateId: guid,
    StartTimeUtc: DateTime,
    EndTimeUtc: DateTime
    ..
    ..
    SoapNoteRevisions: Array {
        _id: Guid,
        IsCurrentRevision: boolean,
        ..
        ..
      }
  }
  </code></pre>
  
  <p>I got rid of the unneeded bits as the document itself has a fair bit of fields within the revision as well (another sub array) </p>