in Education by
I'm trying to connect to a MongoDB database with a username and password using Mongoose in Node.js. All the docs say that the connection string should look like mongodb://username:password@host:port/db However, the password contains the '@' character in it. How can I make a connection string out of this that mongoose will understand? Can I escape the '@' in the password or is there another method of connecting I have to use? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Use this syntax: // use %40 for @ mongoClient.connect("mongodb://username:p%40ssword@host:port/dbname?authSource=admin", { useNewUrlParser: true }, function(err, db) { } );

Related questions

0 votes
    I'm trying to connect to a MongoDB database with a username and password using Mongoose in Node.js. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 7, 2022 in Education by JackTerrance
0 votes
    The boiling point of water at 750mmHg is 99.63∘C . How muCHM sucrose is to be added to 500g of water suCHM that it boils at 100∘C . Select the correct answer from above options...
asked Jan 5, 2022 in Education by JackTerrance
0 votes
    @ Explain the concept houe internet works with hell of an example. And Select the correct answer from above options...
asked Dec 2, 2021 in Education by JackTerrance
0 votes
    Most computers have BIOS which can be configured so that it can ask for a password once the system starts. ... -for-Cyber Security:,Cyber Security-Jobs:,Cyber Security Applications...
asked Nov 1, 2021 in Education by JackTerrance
0 votes
    Calculate the mass of ascorbic acid ( Vitamin C,C6H8O6) to be dissolved in 75g of acetic acid to lower its melting ... .Kf=3.9Kkgmol-1 Select the correct answer from above options...
asked Jan 5, 2022 in Education by JackTerrance
0 votes
    Determine the amount of CaCl2 (i = 2.47) dissolved in 2.5 L of water sucjh that its osmotic pressure is 0.75 atm at 27∘C . Select the correct answer from above options...
asked Jan 5, 2022 in Education by JackTerrance
0 votes
    Suggest a way to determine ∧m∘ value of water. Select the correct answer from above options...
asked Jan 5, 2022 in Education by JackTerrance
0 votes
    The conductivity of 0.00241M acetic acid is 7.896 10-5Scm-1 . Calculate its molar conductivity. If ∧ ∘ ... its dissociation constant ? Select the correct answer from above options...
asked Jan 5, 2022 in Education by JackTerrance
0 votes
    In each of the following pairs, which will conuct more electricity? a. Cu wire at 30∘C and 60∘C . b. ... 1M propanioc acid solutions. Select the correct answer from above options...
asked Jan 5, 2022 in Education by JackTerrance
0 votes
    Out of HBr and NaBr , which will have greater value for ∧ ∘ m and why ? Select the correct answer from above options...
asked Jan 5, 2022 in Education by JackTerrance
0 votes
    Why ∧ ∘ m for weak electrolyte (e.g.,NH4OH or CH3COOH) cannot be determined experimentally ? Select the correct answer from above options...
asked Jan 4, 2022 in Education by JackTerrance
0 votes
    The decomposition of A into product has value of k as 4.5 103s-1 at 10∘C and energy of activation of 60kJmol-1 . At ... be 1.5 104s-1? Select the correct answer from above options...
asked Jan 4, 2022 in Education by JackTerrance
0 votes
    What is the purpose of @ in PHP?...
asked Jul 13, 2021 in Education by JackTerrance
0 votes
    I have batch of user accounts and every user account's password is not crypted.I want to insert to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I'm trying to get an authorization token using the Username-Password flow (as described in the final section of this ... work for me. Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
...