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

Include mention of exception-handling in mongo scripts

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • manual
    • None

    Description

      Description

      I believe that we can extend the follow page to include mention of error handling in mongo shell scripts: https://docs.mongodb.com/manual/tutorial/write-scripts-for-the-mongo-shell/

      Could we include mention of asserts, like assert.commandWorked()? And instruct folks on how to use them to ensure mongo shell returns with the expected status code?

      Available assert commands can be found here: https://github.com/mongodb/mongo/blob/r4.0.5/src/mongo/shell/assert.js

      Scope of changes

      • Investigate usage of assert commands in mongo shell
      • Create examples of using assert commands to support better error handling in shell scripts
      • Backport to 4.0/3.6

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            kelsey.schubert@mongodb.com Kelsey Schubert
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

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