title: mongodb findOneAndUpdate get only updated fields
body: <p>I am using <code>mongodb</code> to insert and update some documents in some collection. When I update a document, I want to get the modified fields only. I can get the complete new document (including the modified fields) by using the <code>returnOriginal</code> option for updates, but it gives me all the properties.</p>
  
  <p>From the <a href="http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndUpdate" rel="nofollow noreferrer">docs</a>:</p>
  
  <blockquote>
    <p>returnOriginal | optional | When false, returns the updated document
    rather than the original. The default is true</p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>let result = await db.myCollection.findOneAndUpdate(
          {_id: ObjectId('5a2451399054bf000453c332')}, 
          data,
          {returnOriginal: true}
      );
  </code></pre>
  
  <p>where <code>data</code> can be either one field, or multiple fields, for example:</p>
  
  <pre><code>let data = {field1: 'newValue1'};
  </code></pre>
  
  <p>or</p>
  
  <pre><code>let data = {field1: 'newValue1', field2: 'newValue2'};
  </code></pre>
  
  <p>I would want to get those fields only, but the result of the update is giving me the entire object, including the _id property and all others, even if they weren't modified.</p>
  
  <p>What I'm looking for is an easy way (a mongodb function or property would be ideal) to <strong>get only the modified fields</strong>, if there is such a way, rather than comparing both objects (before and after).</p>
  
  <p>Using <a href="http://mongodb.github.io/node-mongodb-native/" rel="nofollow noreferrer">mongodb node driver</a>:</p>
  
  <pre><code>"mongodb": "^3.1.6"
  </code></pre>