






















mongodb://localhost:27017
mongodb://root:123456@localhost:27017/testdb?authSource=admin
1、连接本地数据库服务器,端口是默认的。
mongodb://localhost
2、使用用户名fred,密码foobar登录localhost的admin数据库。
mongodb://fred:foobar@localhost
3、使用用户名fred,密码foobar登录localhost的baz数据库
mongodb://fred:foobar@localhost/baz
4、连接 replica pair, 服务器1为example1.com服务器2为example2
mongodb://example1.com:27017,example2.com:27017
5、连接 replica set 三台服务器 (端口 27017, 27018, 和27019)
mongodb://localhost,localhost:27018,localhost:27019
原文链接:https://blog.csdn.net/studyofnet/article/details/84545021
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。