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

Check for failure in cleanupOrphaned script

    XMLWordPrintableJSON

Details

    Description

      The example code shows how to run cleanupOrphaned in a loop, so as to clean all orphans in a collection. This is more than just sample code, this is what is actually used in the field to clean up orphans on real systems.

      Earlier on this page the conditions that can cause cleanupOrphaned to fail are explained.

      However, this code does not check if the cleanupOrphaned command has failed (ie. it doesn't check the "ok" field of the command's result). This means that the script will plough on regardless, and doesn't inform the user of this problem. Suggest that it print out the whole result document, as well as an error if it detects result.ok != 1

      Attachments

        Activity

          People

            kay.kim@mongodb.com Kay Kim (Inactive)
            kevin.pulo@mongodb.com Kevin Pulo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              8 years, 44 weeks, 5 days ago