How to create a mongodb user for the first time in a Nodejs Application
<p>I am using MongoDB with mongoose in the local system in which the mongodbURL did not have username and password. Therefore the database used to get created at the first time when I ran it using the syntax </p>

<pre><code> mongodb://localhost:27012/database
</code></pre>

<p>But now I want to use a username and password for the database, therefore, I used the given syntax</p>

<pre><code>   mongodb://username:password@localhost:27012/database
</code></pre>

<p>But I now the user does not get created automatically and the script gives me an authentication failure error</p>

<p>How should I create the user the first time?</p>