title: Form for submitting multiple fields
body: <p>I want to create a form which has 10 titles, 10 body and 10 images inside it. Like Instagram but captions are different for every picture. I want to insert it into an array of each. An array of title containing 10 titles, an array of bodies and so on for each part of the post. In the model schema, I created an array like such:</p>
  <pre><code>const postSchema = new mongoose.Schema({
      title:[{
          type:String,
          required:true
      }],
      body:[{
          type:String,
          required:true
      }],
      photo:[{
          type:String,
          require:false
      }],
      postedBy:{
          type:ObjectId,
          ref:'User'
      }
  })
  mongoose.model('Post',postSchema)
  </code></pre>
  <p>In the routes file</p>
  <pre><code>router.post('/createpost',requireLogin,(req,res)=&gt;{
      const {title=[],body=[],pic=[]} = req.body 
      if(!title[0] || !body[0]){ //atleast 1 body and 1 title should be present
      return  res.status(422).json({error:&quot;Please add all the fields&quot;})
      }
      
      const post = new Post({
          title[],
          body[],
          photo:pic[],
          postedBy:req.user
      })
      post.save()
      .then(result=&gt;{
          res.json({post:result})
      })
      .catch(err=&gt;{
          console.log(err)
      })
  })
  </code></pre>
  <p>but this is certainly not right
  Also, how to stop this at 10 fields only</p>