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.
You can use the following:
mongoose.connect('mongodb://username:password@host:port/database
In your case:
mongoose.connect('mongodb://root:password@dds-xxxx.mongodb.rds.aliyuncs.com:3717/admin
You can find more at: http://mongoosejs.com/docs/connections.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.