db.collection.dropSearchIndex()
定義
バージョン 7.0 で追加: (6.0.7 以降でも使用可能)
既存の Atlas Search インデックスを削除します。
重要
mongosh メソッド
このページでは、mongosh
メソッドについて記載しています。ただし、データベースコマンドや Node.js などの言語固有のドライバーのドキュメントには該当しません。
データベースコマンドについては、dropSearchIndex
コマンドを参照してください。
MongoDB API ドライバーについては、各言語の MongoDB ドライバー ドキュメントを参照してください。
互換性
このメソッドは、次の環境でホストされている配置で使用できます。
MongoDB Atlas はクラウドでの MongoDB 配置のためのフルマネージド サービスです
重要
このコマンドはサーバーレスインスタンスではサポートされていません。 詳細については、「サポートされていないコマンド 」を参照してください。
構文
コマンド構文:
db.<collection>.dropSearchIndex(<name>)
コマンドフィールド
dropSearchIndex()
takes the following field:
フィールド | タイプ | 必要性 | 説明 |
---|---|---|---|
| string | 必須 | Name of the search index to drop. |
動作
After you run dropSearchIndex()
, there may be a delay between when you
receive a response from the command and when the index is deleted.
検索インデックスのステータスを確認するには、 $listSearchIndexes
集計ステージを使用します。 インデックスが削除されると、そのインデックスは$listSearchIndexes
の出力に表示されなくなります。
アクセス制御
If your deployment enforces access control, the user running the
dropSearchIndex()
method must have the
dropSearchIndex
privilege action on the database:
{ resource: { database : true }, actions: [ "dropSearchIndex" ] }
組み込みのdbAdmin
} ロールとreadWrite
ロールによってdropSearchIndex
特権が付与されます。 次の例では、 qa
データベースでreadWrite
ロールを付与しています。
db.grantRolesToUser( "<user>", [ { role: "readWrite", db: "qa" } ] )
例
次の例では、 movies
コレクションにあるsearchIndex01
という名前の検索インデックスを削除します。
db.movies.dropSearchIndex("searchIndex01")