Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-64416

Have view creation return the same error as collection creation

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 6.0.1, 6.1.0-rc0
    • None
    • None
    • Minor Change
    • v6.0
    • Execution Team 2022-05-16, Execution Team 2022-05-30, Execution Team 2022-06-13

    Description

      Currently creating a view would returns an error code 17399 instead of `NamespaceExists` error in case of namespace collision. Since view creation and collection creation use the same API, returning different errors would be confusing to users and they could easily miss catching this error in their code. so we should have view creation return the same error as collection creation to make them consistent. This ticket can also investigate if we return inconsistent errors in other cases in addition to namespace collision.

      > db.runCommand({create: "bar", viewOn: "aaa", pipeline: []})
      {
      	"ok" : 0,
      	"errmsg" : "Cannot create collection test.bar - collection already exists.",
      	"code" : 17399,
      	"codeName" : "Location17399"
      }
      

      Attachments

        Issue Links

          Activity

            People

              yujin.kang@mongodb.com Yujin Kang Park
              wenbin.zhu@mongodb.com Wenbin Zhu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: