Details
-
Bug
-
Resolution: Won't Do
-
Major - P3
-
None
-
None
Description
The problem is that the db.upgradeCheckAllDBs() and db.upgradeCheck() helpers will only validate the data if true option is specified - you can tell that from the source code:
|
> db.upgradeCheckAllDBs
|
function (checkDocs) { // <== here's the option that enforces document check |
"use strict"; |
|
|
var self = this; |
if (self.getName() !== "admin") { |
throw Error("db.upgradeCheckAllDBs() can only be run from the admin database"); |
}
|
|
|
var dbs = self.getMongo().getDBs(); |
var goodSoFar = true; |
|
|
// run db level checks on each db |
dbs.databases.forEach(function(dbObj) { |
if (!dbUpgradeCheck(self.getSiblingDB(dbObj.name), checkDocs)) { |
goodSoFar = false; |
}
|
});
|
|
|
if (goodSoFar) { |
print("Everything is ready for the upgrade!"); |
return true; |
}
|
print("To fix the problems above please consult " + |
"http://dochub.mongodb.org/core/upgrade_checker_help"); |
return false; |
}
|
If you run it as suggested in the documentation, then the helper will not be able to detect if, for instance there are index keys that are violating the index key limit of 1024 bytes e.g.:
db.getSiblingDB("admin").upgradeCheckAllDBs() |
In order to get that behaviour it should be executed as:
db.getSiblingDB("admin").upgradeCheckAllDBs(true) |
Likewise for upgradeCheck(), it should be executed as:
db.upgradeCheck( { collection: '<collection_name>' }, true ); |
While the mentioned helpers were removed from v3.6, they are still has to be used by users who are migrating into Atlas. We should update the docs for v3.2 and 3.4 to reflect that the true option needs to be specified separately in order to enforce the document validation.