无法将猫鼬连接到阿特拉斯 [英] Fail to connect Mongoose to Atlas

查看:83
本文介绍了无法将猫鼬连接到阿特拉斯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总是连接到"admin"数据库,它是已修复的错误.

I'm always connecting to the "admin" DB, which is a fixed bug.

使用Mongoose 5.0.6 MongoDb 3.6并尝试连接到Atlas.

Using Mongoose 5.0.6 MongoDb 3.6 and trying to connect to Atlas.

  1. 我的问题是,Mongoose 5.0.6依赖哪个驱动程序?
  2. 我怎么知道猫鼬何时会得到修复?
  3. 在另一个方向上,是否有一种方法可以与MongoDB连接,然后将该连接与 猫鼬?
  1. My question, what driver Mongoose 5.0.6 depend on?
  2. How can I find out when Mongoose will have that fix?
  3. On a different direction, is there a way to connect with MongoDB then use this connection with Mongoose?

欢呼

推荐答案

基本上,您应该尝试使用url链接进行连接,并在mongoose connect方法上指定数据库名称 因此,如果您的群集链接为:

Basically you should try connecting with your url link, and specify the DB name on the mongoose connect method so if your cluster link is:

mongodb+srv://userName:Passwrod@clustor.mongodb.net/

,您的数据库名称是:

testDB

然后您应按以下方式调用mongoose.connect方法:

then you should call the mongoose.connect method as follows:

mongoose.connect('mongodb+srv://userName:Passwrod@cluster.mongodb.net/', {dbName: 'testDB'});

这篇关于无法将猫鼬连接到阿特拉斯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆