title: Can not connect to the databaseMongoParseError: Unescaped at-sign in authority section
body: <p>I am trying to connect to mongodb server in my nodeJS project. I have a db config file as DB.js</p>
  
  <pre><code>module.exports = {
      DB: 'mongodb+srv://user%40gmail.com:%24ugar@cluster-jfgsm.mongodb.net/test?retryWrites=true'
   };
  </code></pre>
  
  <p>username contains @ (%40) mark as it is an email id and the password contains $(%24) characters.</p>
  
  <p>And i have connected that in my server.js file as </p>
  
  <pre><code>    mongoose = require('mongoose'),
      config = require('./config/DB');
  
      const app = express();
  
      mongoose.Promise = global.Promise;
      mongoose.connect(config.DB,  { useNewUrlParser: true } ).then(
        () =&gt; {console.log('Database is connected') },
        err =&gt; { console.log('Can not connect to the database'+ err)}
      );
  </code></pre>
  
  <p>and I have added the custom <code>serve</code> option in my package.json file to run the nodemon. </p>
  
  <pre><code>"scripts": {
      "ng": "ng",
      "start": "ng serve",
      "build": "ng build",
      "test": "ng test",
      "lint": "ng lint",
      "e2e": "ng e2e",
      "serve": "nodemon server.js"
    },
  </code></pre>
  
  <p>But when i tried to run the project using the command <code>npm run serve</code>, i am getting an error message in the console </p>
  
  <blockquote>
    <p>Can not connect to the databaseMongoParseError: Unescaped at-sign in
    authority section</p>
  </blockquote>
  
  <p>I have searched many questions in the stack-overflow also but nothing worked for me. </p>
  
  <p>Any help is appreciated. 
  Thank You</p>