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

Check for failure in cleanupOrphaned script

    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

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

            9 years, 25 weeks ago