title: Saving data into MongoDb returns an ObjectParameterError
body: <p>I am practicing on saving data into MongoDb using Node.js.</p>
  
  <p>I have set up Express server and created a Mongoose model but when I try to save some data through Postman it keeps returning an ObjectParameterError.</p>
  
  <p>Mongoose version is 5.5.13 and Express version is 4.17.1.</p>
  
  <p>Connecting to MongoDb through Mongoose has no problem since it does not return any errors at least, but the problem is when I am trying to save some data with a post request.</p>
  
  <p>Here is my post request from my server.js:</p>
  
  <pre><code>router.post("/create_contact", (req, res) =&gt; {
    const { name, number } = req.body;
  
    let contact = new ContactData(name, number);
  
    contact.save((error, contact) =&gt; {
      if (error) {
        return console.error(error);
      }
  
      return res.json(contact);
    });
  });
  </code></pre>
  
  <p>And my data.js that defines the Mongoose Schema and model:</p>
  
  <pre><code>const mongoose = require("mongoose");
  
  const ContactSchema = mongoose.Schema({
    name: String,
    number: Number
  });
  
  module.exports = mongoose.model("ContactData", ContactSchema);
  </code></pre>
  
  <p>As you can see, it only has 2 types of data in it: name and number.</p>
  
  <p>I want to save this simple contact data into local MongoDb but I am getting this one Error:</p>
  
  <pre><code>ObjectParameterError: Parameter "obj" to Document() must be an object, got John Doe
      at new ObjectParameterError (D:\LearnReact\db\backend\node_modules\mongoose\lib\error\objectParameter.js:25:11)
      at model.Document (D:\LearnReact\db\backend\node_modules\mongoose\lib\document.js:73:11)
      at model.Model (D:\LearnReact\db\backend\node_modules\mongoose\lib\model.js:96:12)
      at new model (D:\LearnReact\db\backend\node_modules\mongoose\lib\model.js:4580:15)
      at router.post (D:\LearnReact\db\backend\server.js:28:17)
      at Layer.handle [as handle_request] (D:\LearnReact\db\backend\node_modules\express\lib\router\layer.js:95:5)
      at next (D:\LearnReact\db\backend\node_modules\express\lib\router\route.js:137:13)
      at Route.dispatch (D:\LearnReact\db\backend\node_modules\express\lib\router\route.js:112:3)
      at Layer.handle [as handle_request] (D:\LearnReact\db\backend\node_modules\express\lib\router\layer.js:95:5)
      at D:\LearnReact\db\backend\node_modules\express\lib\router\index.js:281:22
      at Function.process_params (D:\LearnReact\db\backend\node_modules\express\lib\router\index.js:335:12)
      at next (D:\LearnReact\db\backend\node_modules\express\lib\router\index.js:275:10)
      at Function.handle (D:\LearnReact\db\backend\node_modules\express\lib\router\index.js:174:3)
      at router (D:\LearnReact\db\backend\node_modules\express\lib\router\index.js:47:12)
      at Layer.handle [as handle_request] (D:\LearnReact\db\backend\node_modules\express\lib\router\layer.js:95:5)
      at trim_prefix (D:\LearnReact\db\backend\node_modules\express\lib\router\index.js:317:13)
  </code></pre>
  
  <p>What am I missing? Thanks in advance for your help.</p>