Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在哪里可以找到MongoDB连接字符串的dbname?_Mongodb - Fatal编程技术网

在哪里可以找到MongoDB连接字符串的dbname?

在哪里可以找到MongoDB连接字符串的dbname?,mongodb,Mongodb,我正在尝试将我的应用程序连接到mongodb,我从mongodb atlas获得了一个连接字符串,要求我替换用户名和密码,我得到了它,但它还说用数据库名替换dbname。。。我从来都不记得我设置了数据库名,我在哪里可以找到它?这是我拥有的连接字符串: mongodb+srv://<username>:<password>@cluster0.pfose.mongodb.net/<dbname>?retryWrites=true&w=majority m

我正在尝试将我的应用程序连接到mongodb,我从mongodb atlas获得了一个连接字符串,要求我替换用户名和密码,我得到了它,但它还说用数据库名替换dbname。。。我从来都不记得我设置了数据库名,我在哪里可以找到它?这是我拥有的连接字符串:

mongodb+srv://<username>:<password>@cluster0.pfose.mongodb.net/<dbname>?retryWrites=true&w=majority
mongodb+srv://:@cluster0.pfose.mongodb.net/?retryWrites=true&w=mailty
默认情况下,是测试,但要创建自己的数据库名,需要将更改为您感兴趣的数据库名。MongoDB Atlas将根据名称自动为您创建数据库。
例如:
使用username=Que和password=pin123为QLAB创建db

mongodb+srv://Que:pin123@cluster0.pfose.mongodb.net/Qlabs?retryWrites=true&w=多数

适用于那些希望在GUI中创建db的用户


如果您创建了一个atlas帐户并阅读了本教程,那么他们可能会让您创建一个模拟集群,默认情况下,它的名称将为Cluster0。这就是您的数据库名。

您可以使用默认数据库名
test
。一旦连接,您就可以看到还有哪些其他数据库。是的,在加载示例数据之后,在“集合”选项卡下,我可以看到“创建数据库”,如上所示。