title: Importing data into a Mongodb schema
body: <p>I am new to Node.js and Express.js. I am working a Voting App to enhance my skills. The following is the data schema I created.</p>
  
  <pre><code>const mongoose = require('mongoose');
  const register = mongoose.Schema;
  
  const Voter = new register({ 
      firstName:{
          type:String,
          required:true,
      },
  
      lastName:{
          type:String,
          require:true
      },
  
      email:{
          type:String,
          unique:true,
          required:true
      },
  
      vote:{
          type:Number
      }
  })
  
  module.exports = mongoose.model('Voter',Voter)
  </code></pre>
  
  <p>Most of the examples/practice problems I encountered require the user to complete the data input on ONE page. <strong>But I am thinking if there is a way to have 3 keys filled using one page, and 1 other key filled using another page.</strong> </p>
  
  <p>My preliminary design is to have the user filled in their names and email in the <strong>registration page</strong> and save them to the database, and once that is completed the user will be directed to <strong>voting page</strong> to click vote button and have that input saved to the database. In total 4 entries are saved in one Schema. </p>
  
  <p>I have had the registration page constructed. </p>
  
  <pre><code>const express=require('express');
  const router=express.Router();
  const Voter = require('../models/voter');
  
  router.get('/',(req,res)=&gt;{
      res.render('cand/profiles')
  })
  
  router.get('/loggedin',async (req,res)=&gt;{
      res.render('cand/index')
  })
  
  router.post('/loggedin',async (req,res)=&gt;{
      const register = new Voter({
          firstName:req.body.first_Name,
          lastName:req.body.last_Name,
          email:req.body.email,
      })
  
      if (req.body.first_Name!==''||req.body.last_Name!==''||req.body.email!==''){
          var newVoter = await register.save()
          //res.send('Hello')
          res.render('cand/index',{
              voterFirstName:newVoter.firstName,
              voterLastName:newVoter.lastName,
              voterEmail:newVoter.email
          })
          console.log(newVoter)
  
      }else{
          res.redirect('/')
      }
  
  })
  
  module.exports=router
  </code></pre>
  
  <p>How am I supposed to deliver those filled key to the <strong>voting page</strong>? </p>