New in version 2.6.
Performs a preliminary check for upgrade preparedness to 2.6. The helper, available in the 2.6
mongoshell, can run connected to either a 2.4 or a 2.6 server in the
The method cycles through all the databases and checks for:
- documents with index keys longer than the index key limit,
- documents with
illegal field names,
- collections without an
- indexes with invalid specifications, such as an index key with an empty or illegal field name.
Additional 2.6 changes that affect compatibility with older versions require manual checks and intervention. See Compatibility Changes in MongoDB 2.6 for details.
db.upgradeCheckAllDBs() performs collection scans and has an impact on performance. To
mitigate the performance impact:
- For sharded clusters, configure to read from secondaries and run the
command on the
- For replica sets, run the command on the secondary members.
db.upgradeCheckAllDBs() can miss new data during the check when run on a live system with
active write operations.
For index validation,
db.upgradeCheckAllDBs() only supports the check of version
indexes and skips the check of version
You must run the
db.upgradeCheckAllDBs() operation in the
The following example connects to a secondary running on
db.upgradeCheckAllDBs() against the
database. Because the output from the method can be quite large, the
example pipes the output to a file.
./mongo --eval "db.getMongo().setSlaveOk(); db.upgradeCheckAllDBs();" localhost/admin | tee /tmp/upgradecheckalldbs.txt
The upgrade check can return the following errors when it encounters incompatibilities in your data:
Index Key Exceed Limit¶
Document Error: key for index '<indexName>' (<indexSpec>) too long on document: <doc>
To resolve, remove the document. Ensure that the query to remove the document does not specify a condition on the invalid field or field.
Documents with Illegal Field Names¶
Document Error: document is no longer valid in 2.6 because <errmsg>: <doc>
To resolve, remove the document and re-insert with the appropriate corrections.
Index Specification Invalid¶
Index Error: invalid index spec for index '<indexName>': <indexSpec>
To resolve, remove the invalid index and recreate with a valid index specification.
Collection Error: lack of _id index on collection: <collectionName>
To resolve, create a unique index on
Warning: upgradeCheck only supports V1 indexes. Skipping index: <indexSpec>
To resolve, remove the invalid index and recreate the index omitting the version specification, or reindex the collection. Reindex operation may be expensive for collections that have a large amount of data and/or a large number of indexes.