title: Updating the nested array element value in Mongo DB
body: <p>I'm new to MERN, I have created a system for the teachers to check the assignment.
  My Schema looks like this</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const mongoose = require('mongoose')
  const xyzSchema = new mongoose.Schema({
      user:{
          type:mongoose.Schema.Types.ObjectId,
          ref:'user_collections'
      },
      assignments:[{
          title_assignment:{
              type:String,
              required:true
          },
          description_assignment:{
              type:String,
              required:true
          },
          created_at:{
              type:Date,
              required:true,
              default:Date.now()
          },
          files:[],
          submitted:[{
              user:{
                  type:mongoose.Schema.Types.ObjectId,
                  ref:'user_collections'
              },
              files:[],
              created_at:{
                  type:Date,
                  required:true,
                  default:Date.now()
              },
              checked:{
                  type:Boolean,
                  default:false
              }
          }],
          due_dt:{
              type:Date,
              required:true
          }
      }],
  })
  
  module.exports = mongoose.model('abc',xyzSchema)</code></pre>
  </div>
  </div>
  </p>
  
  <p>On Click of <strong>checked</strong> on frontend, I wan't to update the value of "checked" to true from "false".</p>
  
  <p>My Route looks like this</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>router.put('/assignments/check',
  auth,
  async(req,res)=&gt;{
     
      try {
          let check = await Classroom.findOne(
              {"assignments._id":req.body.assignment_id,"assignments.submitted.user":req.body.user_id},
              {$set:{"assignments.$.submitted.$.checked":"true"}}} 
          )
          res.json(check)
      } catch (error) {
          console.error(error)
      }
  })</code></pre>
  </div>
  </div>
  </p>
  
  <p>This code is not working for me. Can someone please suggest me something?
  What I want to do is
  1) Find the Aassignment using ID and submitted assignment array using the User ID inside it
  2) Change the "checked" value for that user to "true"</p>