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

Have view creation return the same error as collection creation

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.1, 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Minor Change
    • v6.0
    • Execution Team 2022-05-16, Execution Team 2022-05-30, Execution Team 2022-06-13

      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"
      }
      

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

              Created:
              Updated:
              Resolved: