AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。
Docs Menu

db.dropUser()(mongoshメソッド)

db.dropUser(username, writeConcern)

現在のデータベースからユーザーを削除します。

重要

mongosh メソッド

This page documents a mongosh method. This is not the documentation for database commands or language-specific drivers, such as Node.js.

データベースコマンドについては、dropUser コマンドを参照してください。

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

The db.dropUser() method takes the following arguments:

Parameter
タイプ
説明

username

string

データベースから削除するユーザーの名前。

writeConcern

ドキュメント

任意。 操作の 書込み保証( write concern ) のレベル。 詳しくは、 書込み保証(write concern) の仕様を参照してください。

The db.dropUser() method wraps the dropUser command.

userAdminAnyDatabase ロールを持つユーザーを削除する前に、ユーザー管理特権を持つ別のユーザーが少なくとも 1 人いることを確認してください。

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

重要

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

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

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

If run on a replica set, db.dropUser() is executed using "majority" write concern by default.

データベースからユーザーを削除するには、データベースに対して dropUser アクションが必要です。

The following db.dropUser() operation drops the reportUser1 user on the products database.

use products
db.dropUser("reportUser1", {w: "majority", wtimeout: 5000})