Reputation: 353
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.
Upvotes: 1
Views: 170
Reputation: 1878
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
Upvotes: 1