title: Node js and mongoose schema date.now code not working properly
body: <p>I have created this schema for user registration:</p>
  
  <pre><code>let userSchema = new mongoose.Schema({
      lname: String,
      fname: String,
      username: String,
      email: String,
      password: String,
      registrationDate: {
          type: Date,
          default: Date.now()
      },
      referedBy: {
          type: String,
          default: ''
      },
      referalEnd: {
          type: Date,
          default: Date.now() + 5*365*24*60*60*1000
      },
      userRefererId: {
          type: String,
          default: uniqid()
      }
  });
  </code></pre>
  
  <p>As you can see, there is a <code>Date.now</code> function and <code>uniqid</code> function in the schema.</p>
  
  <p>Those functions can be used approximately once every 5 minutes,
  because if I create two users a few seconds apart, it generates the same uniqid and shows the same date.</p>
  
  <p><img src="https://i.stack.imgur.com/K9cRH.png" alt="Image of my MongoDB collection"></p>