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

db.コレクション.reIndex()(mongoshメソッド)

重要

mongosh メソッド

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

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

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

db.collection.reIndex()

バージョン 6.0 から非推奨。

Attempting to run the db.collection.reIndex() method writes a warning message to the log.

The db.collection.reIndex() drops all indexes on a collection and recreates them. This operation may be expensive for collections that have a large amount of data and/or a large number of indexes.

警告

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

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

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

重要

This command is not supported in MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.

For MongoDB 5.0 or later, db.collection.reIndex() may only be run on standalone instances.

db.collection.reIndex() はコレクションに対して排他的ロック(W)を取得し、完了するまでコレクションに対する他の操作をブロックします。

MongoDB でのロックの詳細については、「FAQ: 同時実行性」を参照してください。

このページを評価