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

Include mention of exception-handling in mongo scripts

    • Type: Icon: Task Task
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • Affects Version/s: None
    • Component/s: manual
    • Labels:
      None

      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

       

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

              Created:
              Updated:
              1 year, 25 weeks, 3 days ago