title: MongoDB 4.2: Find by id and update another field (boolean) only if its falsy, and identify reason of an empty response
body: <p>I'm trying to find a document by its <code>id</code> field and then update another field (<code>isLocked</code>) of that document only if that field has a value of false. I want to update only the <code>isLockedField</code>.</p>
  
  <p>The MongoDB version is 4.2.</p>
  
  <p>My first approach is to do 2 two queries: </p>
  
  <ol>
  <li>Find the document by its id. If nothing is found, throw a <code>NotFoundError</code>.</li>
  <li>Find and Update the document by doing a query <code>{ id: 'the-id', isLocked: false }</code>, and returning the new document. If this query returns an empty response, it means the document is Locked, then throw a <code>LockedError</code> (423).</li>
  </ol>
  
  <p>Then I'd optimized that approach by doing both queries at the same time. After both promises resolve, throw the specific error if corresponds.</p>
  
  <p>Is there another form that requires only one query to the db and being able to identify, if an empty response is returned, why is empty (not found by its id or because it is locked)?</p>