定義
db.dropAllUsers(writeConcern)現在のデータベースからすべてのユーザーを削除します。
重要
mongosh メソッド
This page documents a
mongoshmethod. This is not the documentation for database commands or language-specific drivers, such as Node.js.データベースコマンドについては、
dropAllUsersFromDatabaseコマンドを参照してください。MongoDB API ドライバーについては、各言語の「MongoDB ドライバーのドキュメント」を参照してください。
警告
The
db.dropAllUsers()method removes all users from the database.The
db.dropAllUsers()method takes the following arguments:フィールドタイプ説明writeConcernドキュメント
任意。 操作の 書込み保証( write concern ) のレベル。 詳しくは、 書込み保証(write concern) の仕様を参照してください。
The
db.dropAllUsers()method wraps thedropAllUsersFromDatabasecommand.
互換性
このメソッドは、次の環境でホストされている配置で使用できます。
重要
This command is not supported in MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.
MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン
MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン
動作
レプリカセット
If run on a replica set, db.dropAllUsers() is executed using "majority" write concern by default.
必要なアクセス権
例
The following db.dropAllUsers() operation drops every user from the products database.
use products db.dropAllUsers( {w: "majority", wtimeout: 5000} )
結果ドキュメントのnフィールドには、削除されたユーザーの数が表示されます。
{ "n" : 12, "ok" : 1 }