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" }
- is depended on by
-
TOOLS-3141 Investigate changes in SERVER-64416: Have view creation return the same error as collection creation
- Closed