title: MongoDB findOneAndUpdate Updates But Nothing Changes
body: <p>I have a cluster on atlas. My current object seems like below:</p>
  
  <pre><code> {
     "_id": {
        "$oid":"5e9d8ccfb3d80e3824bf856c"
     },
     "user": {
        "name":"test",
        "channelGroups": [
           {
              "active": true,
              "name": "an example of test",
              "creationDate": "20 Apr 2020 at 13:35 PM",
              "summary": "an example summary",
              "channels": []
           }
        ]
     },
     "__v": {
        "$numberInt":"0"
     }
  }
  </code></pre>
  
  <p>Here is my controller method: ( I use mongoose with express )</p>
  
  <pre><code>createANewChannel: (req, res) =&gt; {
  
      channelGroupModel.findOneAndUpdate({
              "user.name": "test", "user.channelGroups": {
                  $elemMatch: {
                      "name": "an example of test"  // req.params.slug
                  }
              }
          }, { $push: {
                      "channelGroups.channels": {
                          filter: {
                              keyword: "#example",
                              keywordType: "hashtag",
                              active: true,
                              fetchFrequency: 1,
                          },
                          tweets: []
                      }
                  }
          },
          (error, success)  =&gt; {
              if (error) {
                  console.log(error);
              } else {
                  console.log(success);
              }
          }
      );
  
  
      res.send('ok');
  },
  </code></pre>
  
  <p><strong><em>Problem:</em></strong>
  I want to push a new channel object into the channelGroups array according to channelGroups' name value. My code works but nothing happens.</p>
  
  <p>=====================================================================</p>
  
  <p><strong><em>Updated working version</em></strong>: </p>
  
  <pre><code>channelGroupModel.findOneAndUpdate(
      {
          "user.name": "test"
      },
      {
          $push: {
              "user.channelGroups.$[elem].channels": {
                  filter: {
                      keyword: "#example",
                      keywordType: "hashtag",
                      active: true,
                      fetchFrequency: 1,
                  },
                  tweets: []
              }
          }
      },
      {
          arrayFilters: [{"elem.name": "an example of test"}]
      },
      (error, success) =&gt; {
          if (error) {
              console.log(error);
          } else {
              console.log(success);
          }
      }
  )
  </code></pre>