title: Mongoose $push Not Working Properly. Unable to Push into array
body: <p>I have a model which consist of an array.</p>
  <pre><code>
  const MyModelSchema= new mongoose.Schema({
    
    username:{
  
          Type:String
      }
  
    results: [
      {
        subject: {
          Type: String,
        },
        marks: {
          Type: String,
        }
      },
    ],
  
   
  });
  
  module.exports = MyModel = mongoose.model(
    &quot;mymodel&quot;,
    MyModelSchema
  );
  </code></pre>
  <p>I am trying to push some element using findOneAndUpdate() method available in mongoose package as below.</p>
  <pre><code>     const { id, subject, marks } = req.body;
  
       const myModel= await MyModel.findOneAndUpdate(
          { _id: id },
          {
            $push: {
              results: {
                subject: subject,
                marks:marks
              },
            },
          }
        );
  
  </code></pre>
  <p>But the query is not updating the mongodb properly. Below are the results from the above query.</p>
  <pre><code>{
    
      &quot;_id&quot;: &quot;6009557eea7f84203c491551&quot;,
      &quot;username&quot;:&quot;John Doe&quot;
      &quot;__v&quot;: 0,
      &quot;results&quot;: [
          {
              &quot;_id&quot;: &quot;60096876b4d10b1b3c6e01fb&quot;
          },
          {
              &quot;_id&quot;: &quot;600968ac1188cd2338a5533f&quot;
          }
      ]
  }
  
  </code></pre>
  <p><strong>It is not pushing the data correctly into the table.</strong></p>