Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection request treated as a query #211

Closed
ghost opened this issue Jun 22, 2017 · 2 comments
Closed

Connection request treated as a query #211

ghost opened this issue Jun 22, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 22, 2017

I connected to the database as the following:

const db = require('monk')('user:examplepassword?@localhost:27017/test');

It returns error:

Error: query parameter @localhost:27017/test is an incomplete value pair

But if the password doesn't have a question mark, it connects. The problem is, my password HAS a question mark, so I can't authenticate to the database.

@mathieudutour
Copy link
Collaborator

Oh that's a weird one. Did you try encodeURIComponent it? (not sure if that will work tho)

@ghost
Copy link
Author

ghost commented Jun 22, 2017

Yes it worked.

const url = 'user:' + encodeURIComponent('examplepassword') + '@localhost:27017/test';
const db = require('db')(url);

Thanks!

@ghost ghost closed this as completed Jun 22, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant