1

I'm new to using MongoDB and would appreciate some help in replicating the following command in my NodeJS application.

mongo --host dds-xxxx.mongodb.rds.aliyuncs.com:3717 -u root -p password --authenticationDatabase admin

I need to be able to connect with these credentials from Node, preferably but not necessarily using the MongoJS library. Any assistance would be greatly appreciated!

Thanks again.

1

1 Answer 1

1

You can use the following:

mongoose.connect('mongodb://username:password@host:port/database

In your case:

 mongoose.connect('mongodb://root:[email protected]:3717/admin

You can find more at: http://mongoosejs.com/docs/connections.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.