title: Data not posting on mongoose with express and jade
body: <h2>My registration form data is not posting on mongoose database Here is my code</h2>
  <p>my code working when i get the data from my database but its not posting code
  please help me guys</p>
  <pre><code>    app.set('views', path.join(__dirname, 'views')); 
           app.set('view engine', 'jade');
           app.use(bodyParser.json());
           app.use(express.static(path.join(__dirname, 'public')));
           app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false }));
  
  
     
  **mongoose connection** 
  
       mongoose.connect(&quot;mongodb://localhost:27017/change&quot;)
   
         .then(() =&gt; console.log('Connected to MongoDB ...')) 
         .catch(err =&gt; console.error('Could not connect to MongoDB....',err));
  </code></pre>
  <h2>Schema</h2>
  <pre><code>   // Schema
      const courseSchema = new mongoose.Schema({
          firstName: String, 
          fName: String,
          add1: String,
          add2: String,
          city: String,
          province: String,
          zip:Number,
          country: String,
          age: Number,
          gender: String,
          color:String,
          Height:Number,
          mTongue:String,
          moi:String,
          disability:String,
          religion:String,
          mHealth:String,
          name:String,
          contact:Number,
          add3:String,
          add4:String,
          city1:String,
          state:String,
          postal:String,
          country1:String,
          RTC:String,
          email: String,
          profileimage:{
              type: String
          },
          date: { type: Date, default: Date.now},
          isPublished: Boolean
      });`
  </code></pre>
  <h2>Routing</h2>
  <pre><code>app.post(&quot;/addname&quot;,upload.single('profileimage'), (req, res) =&gt; {
  const myData = new User(req.body);
  myData.save()
      .then(item =&gt; {
          res.redirect('/');  
      })
      .catch(err =&gt; {
          res.status(400).send(&quot;Unable to save to database&quot;);
      });
  </code></pre>
  <h2>**Jade Code **</h2>
  <p>Here is my registration form code</p>
  <pre><code>    &gt; `form(method='post', action='/addname')
      
      
      hr  
      .row
            .col-sm-6
              .form-group
              label Name 
              input.form-control(type='text', name='firstName', placeholder='Enter Name')      
            .col-sm-6
              .form-group
              label Father Name
              input.form-control(type='text', name='fName', placeholder='Enter Name', required)  
            .col-sm-6
              .form-group
              label Address Line 1
              input.form-control(type='text', name='add1', placeholder='Enter Address Line 1', required)      
            .col-sm-6
              .form-group
              label Address Line 2
              input.form-control(type='text', name='add2', placeholder='Enter Address Line 2', required) 
            .col-sm-6
              .form-group
              label City
              input.form-control(type='text', name='city', placeholder='Enter City', required)
            .col-sm-6
              .form-group
              label State/Province/Region
              select.form-control(name='state', id='' .dropdown-menu , required)
                each val in ['Sindh' , 'Punjab' , 'KPK' ,'Balochistan', 'Gilgit-Baltistan' , 'AJK', 'Islamabad']
                  option=val         
            .col-sm-6
              .form-group
              label Postal / Zip Code
              input.form-control(type='text', name='zip', placeholder='Enter Postal / Zip Code', required) 
            .col-sm-6
              .form-group
              label Country
              input.form-control(type='text', name='country', placeholder='Country', required)      
            .col-sm-6 
              .form-group
              label Age
              input.form-control(type='number', name='age' , placeholder='Age', required)
            .col-sm-6 
              .form-group
              label Gender
              select.form-control(name='gender', id='' .dropdown-menu , required)
                each val in ['Male' , 'Female' , 'Other']
                  option=val   
            .col-sm-6
              .form-group
              label Color
              select.form-control(name='color', id='', required .dropdown-menu)
                each val in ['Fair' , 'Brown' , 'Dark' , 'Black' , 'Wheatish']
                  option=val   
            .col-sm-6
              .form-group
              label Height
              input.form-control(type='text', name='height', placeholder='Enter Height', required)
            .col-sm-6 
              .form-group
              label Mother Tongue
              select.form-control(name='mTongue', id='', required .dropdown-menu)
                each val in ['Sindhi' , 'Balochi' , 'Urdu' , 'Punjabi' , 'Phusto' , 'Other']
                  option=val     
            .col-sm-6
              .form-group
              label Marks of Identification 
              input.form-control(type='text', name='moi', placeholder='Enter Marks of Identification ', required)      
            .col-sm-6
              .form-group
              label Disability if any
              input.form-control(type='text', name='disability', placeholder='Disability if any', required) 
            .col-sm-6
              .form-group
              label Religion
              input.form-control(type='text', name='religion', placeholder='Religion', required)      
            .col-sm-6
              .form-group
              label Mental Helth
              input.form-control(type='text', name='mHealth', placeholder='Enter Mental Helth', required) 
            //- .col-sm-6
            //-   .form-group
            //-   label Missing Person Image
            //-   input.form-control(name='profileimage', type='file')
      hr  
      h2 Information Details
      .row
            .col-sm-6
              .form-group
              label Name
              input.form-control(type='text', name='name', placeholder='Enter Name', required)      
            .col-sm-6
              .form-group
              label Contact No
              input.form-control(type='text', name='contact', placeholder='Enter Contact NO', required)  
            .col-sm-6
              .form-group
              label Address Line 1
              input.form-control(type='text', name='add3', placeholder='Enter Address Line 1', required)      
            .col-sm-6
              .form-group
              label Address Line 2
              input.form-control(type='text', name='add4', placeholder='Enter Address Line 2', required) 
            .col-sm-6
              .form-group
              label City
              input.form-control(type='text', name='city1', placeholder='Enter City', required)
            .col-sm-6
              .form-group
              label State/Province/Region
              select.form-control(name='state', id='' .dropdown-menu , required)
                each val in ['Sindh' , 'Punjab' , 'KPK' ,'Balochistan', 'Gilgit-Baltistan' , 'AJK', 'Islamabad']
                  option=val  
                  
            .col-sm-6
              .form-group
              label Postal / Zip Code
              input.form-control(type='text', name='postal', placeholder='Enter Postal / Zip Code', required) 
            .col-sm-6
              .form-group
              label Country
              input.form-control(type='text', name='country1', placeholder='Country', required)
            .col-sm-6
              .form-group
              label Relation to the child
              input.form-control(type='text', name='RTC', placeholder='Relation to the child', required) 
            .col-sm-6
              .form-group
              label Email
              input.form-control(type='email', name='email', id=&quot;exampleInputEmail1&quot; , placeholder='Email', required) 
             .col-sm-6
              .form-group
              input.btn.btn-primary(type='submit', name='submit',value='Submit')`
  
  [When i posted data ][1]
  </code></pre>
  <p>When i post the data my data is not posting in database and show error but if i find the data show on my page its shows data</p>
  <pre><code>  [1]: https://i.stack.imgur.com/pnGvC.png
  </code></pre>