定義
db.dropUser(username, writeConcern)現在のデータベースからユーザーを削除します。
重要
mongosh メソッド
This page documents a
mongoshmethod. 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タイプ説明usernamestring
データベースから削除するユーザーの名前。
writeConcernドキュメント
任意。 操作の 書込み保証( write concern ) のレベル。 詳しくは、 書込み保証(write concern) の仕様を参照してください。
The
db.dropUser()method wraps thedropUsercommand.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.
必要なアクセス権
例
The following db.dropUser() operation drops the reportUser1 user on the products database.
use products db.dropUser("reportUser1", {w: "majority", wtimeout: 5000})