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.

【MongoDB】URI形式でアクセスしmongoシェルを使用する

Posted at

概要

MongoDBで運用している場合、サーバに直接アクセスしてコマンドをたたくこともあると思います。ホスト名等が分かっていればMongoDBコマンド一覧(自分用メモ)の記事にあるような形式で、mongoシェルを起動できるのですが、MongoDB Atlasなどで運用していてURI形式でアクセスしたいどうすれば良いのかというのが今回の記事です。

対応

MongoDBのドキュメントのConnect to a MongoDB Replica Setにある通り、mongo "アクセスしたいuri"の形式で、uriをダブルクオテーションで囲むような形式で、mongoシェルを起動できます。
MongoDB Atlasでは以下のような形式で起動しました。

mongo "mongodb+srv://use-name:password@cluster.sample.mongodb.net/?retryWrites=true&w=majority"
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?