Docs Menu

db.getMongo()

項目一覧

重要

mongosh メソッド

このページでは、mongosh メソッドについて記載しています。これは Node.js などの言語固有のドライバーのドキュメントではありません

MongoDB API ドライバーについては、各言語の MongoDB ドライバー ドキュメントを参照してください。

db.getMongo()
次の値を返します。The current database connection.

db.getMongo() runs when the shell initiates. Use this command to test that mongosh has a connection to the proper database instance.

注意

The legacy mongo shell has a sub-command, db.getMongo().setSecondaryOk(), which is not available in mongosh. In mongosh, use Mongo.setReadPref() instead.

このメソッドは、次の環境でホストされている配置で使用できます。

  • MongoDB Atlas はクラウドでの MongoDB 配置のためのフルマネージド サービスです

注意

このコマンドは、すべての MongoDB Atlas クラスターでサポートされています。すべてのコマンドに対する Atlas のサポートについては、「サポートされていないコマンド」を参照してください。

  • MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン

  • MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン

項目一覧