Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-11641

Document that upgradeCheckAllDBS() and upgradeCheck() must have an explicit option specified that enforces documents validation

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • Server
    • 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dmitry.ryabtsev@mongodb.com Dmitry Ryabtsev
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              1 year, 14 weeks, 2 days ago