0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Mongo CompassからMongoDB Atlasに接続できない問題(connection stringを使うケース)

Last updated at Posted at 2022-02-02

問題

Mongo CompassからMongoDB Atlasに、connection stringで接続する際に、以下のように表示され接続できませんでした。
1.png

querySrv ETIMEOUT _mongodb._tcp.cluster0.5zhom.mongodb.net

解決策

mongo compass専用のconnection stringではなく、applicationから接続する際のconnection stringを使うと接続できるようです。
それも、node.jsのmongoDB用のドライバーであるmongodbというパッケージのバージョン2.2.12用のもので接続できます。

mongo atlasの管理画面から「Connect」をクリック

2.png

mongo compassではなく、アプリケーション用のほうを選択
3.png

Node.jsの「2.2.12 or later」を選択
4.png

connection stringの<password>となってる箇所をmongoDBのユーザのパスワードに変更。
さきほどのフォームにいれると無事接続完了です🎉
スクリーンショット 2022-02-02 19.36.22.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?