title: How can I add an user at start in nodejs?
body: <p>I want to create a user if I start my connection to localhost and mongoDB but I don´t know how to do it I tried so many things but don´t know how to get an user at start.</p>
  <p>so my Schema looks this way:</p>
  <pre><code>const UserSchema = mongoose.Schema({
      userID: {
          type: String,
          required: true
      },
      userName: {
          type: String,
          required: true
      },
      password: {
          type: String,
          required: true
      },
      isAdministrator: {
          required: Boolean
      }
  });
  </code></pre>
  <p>And my connection is this:</p>
  <pre><code>const dbURI = &quot;mongodb://localhost:27017/test&quot;;
  mongoose.connect(dbURI, {
      useNewUrlParser: true,
      useUnifiedTopology: true
  })
  const db = mongoose.connection;
  
  db.on(&quot;error&quot;, (err)=&gt;{console.error(err)});
  db.once(&quot;open&quot;, () =&gt; { console.log (&quot;Database started successfully&quot;)})
  </code></pre>