title: MongoDB document naming
body: <p>I have tried so many time different things but unable understand that whenever I am saving data into MongoDB why am I getting the name of that document as below</p>
  <p><strong>User.js</strong></p>
  <pre><code>const mongoose = require(&quot;mongoose&quot;);
  const Schema = mongoose.Schema;
  
  const userSchema = new Schema({
    email: {
      type: String,
      require: true,
      unique: true,
      lowercase: true,
    },
    username: {
      type: String,
      require: true,
      unique: true,
      maxLength: 7,
    },
    password: {
      type: String,
      require: true,
      minLength: 8,
    },
  });
  
  const User = mongoose.model(&quot;user&quot;, userSchema);
  
  module.exports = User;
  </code></pre>
  <p>When I have saved the data by hitting API through postman and printing the data in console, the data I am receiving is as below:</p>
  <pre class="lang-json prettyprint-override"><code>    email {
          _id: new ObjectId(&quot;627a4ae94b8958e3fe968311&quot;),
          email: 'abc@abc.com',
          username: 'fzee07',
          password: 'test1234',
          __v: 0
        }
  </code></pre>
  <p>So my question is this that why this object is getting saved and named as <strong>&quot;email&quot;</strong>.</p>
  <p><strong>registerUser.js</strong></p>
  <pre><code>const User = require(&quot;../../models/User&quot;);
  
  const registerUser = async (req, res) =&gt; {
    const { email, username, password } = req.body;
  
    try {
      const e_mail = await User.findOne({});
      console.log(&quot;email&quot;, e_mail);
      if (e_mail.email === email) {
        res.status(409).json({
          success: false,
          msg: &quot;User already exists&quot;,
        });
      } else {
        if (username.length &lt; 8) {
          if (password.length &gt;= 8) {
            const user = User.create({ email, username, password });
            res.status(201).json({
              success: true,
              data: &quot;User Created&quot;,
            });
          } else {
            res.status(401).json({
              success: false,
              data: &quot;Password muste be minimum 8 characters&quot;,
            });
          }
        } else {
          res.status(401).json({
            success: false,
            data: &quot;Username must be less than 8 characters&quot;,
          });
        }
      }
    } catch (err) {
      console.log(err);
    }
  };
  
  module.exports = registerUser;
  
  </code></pre>