title: Password with backslash mongoose mlab
body: <p>I can't seem to find a solution to this issue, I have a database on mlab I should access with a password containing a backslash <code>\</code> character.</p>
  
  <p>I've tried using some of the suggestions in this <a href="https://stackoverflow.com/questions/7486623/mongodb-password-with-in-it">thread</a>, basically encoding manually the password or using an encoding function, but authentification fails nonetheless.</p>
  
  <p>Assuming my password is <code>password\</code>
  Here's what I've noted:
  if my connection URL is : </p>
  
  <ul>
  <li><code>mongodb://username:password\@dsXXXXXX.mlab.com:YYYYY/my_db</code> I obviously have an issue with the escape character as with any javascript string, </li>
  <li><code>mongodb://username:password\\@dsXXXXXX.mlab.com:YYYYY/my_db</code> returns an error <code>Error: Password contains an illegal unescaped character</code>,</li>
  <li><p><code>mongodb://username:${encodeURIComponent("password\\")}@dsXXXXXX.mlab.com:YYYYY/my_db</code> I get <code>Error: Password contains an illegal unescaped character</code> along with <code>the options [uri_decode_auth] is not supported mongoose</code> (because I am trying to decode in <code>mongoose.connect</code> as such:</p>
  
  <pre><code>mongoose.connect(config.database, { //config.database contains the URL above
    uri_decode_auth: true 
  }, function(err, db) {}
  );
  </code></pre></li>
  <li><p><code>mongodb://username:Simplifide35%5C@dsXXXXXX.mlab.com:YYYYY/my_db</code> by using this <a href="https://www.url-encode-decode.com/" rel="nofollow noreferrer">website</a> returns <code>MongoError: Authentication failed.</code></p></li>
  <li><p>Connecting with options like so: </p>
  
  <pre><code>mongoose.connect("mongodb://@dsXXXXXX.mlab.com:YYYYY/my_db",
       {user: 'username', pass: "password\\"}, ()=&gt;{});
  </code></pre>
  
  <p>does not work either with the encoded <code>password%5C</code> nor <code>password\</code>.</p></li>
  </ul>
  
  <p>What are my options aside from changing the password? What am I missing?</p>
  
  <p>Thanks.</p>