[SERVER-64416] Have view creation return the same error as collection creation Created: 10/Mar/22  Updated: 29/Oct/23  Resolved: 30/May/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.1, 6.1.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Wenbin Zhu Assignee: Yujin Kang Park
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
is depended on by TOOLS-3141 Investigate changes in SERVER-64416: ... Closed
Documented
is documented by DOCS-15374 Investigate changes in SERVER-64416: ... Closed
Backwards Compatibility: Minor Change
Backport Requested:
v6.0
Sprint: Execution Team 2022-05-16, Execution Team 2022-05-30, Execution Team 2022-06-13
Participants:

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



 Comments   
Comment by Githook User [ 25/Jul/22 ]

Author:

{'name': 'Yu Jin Kang Park', 'email': 'yujin.kang@mongodb.com', 'username': 'ykangpark'}

Message: SERVER-64416: view creation returns same error as collection creation

(cherry picked from commit 6bd5618937542267553791332394c571973740eb)
Branch: v6.0
https://github.com/mongodb/mongo/commit/698a9acc9b9ef580ab197eaf1a17b7b14b1f065b

Comment by Githook User [ 27/May/22 ]

Author:

{'name': 'Yu Jin Kang Park', 'email': 'yujin.kang@mongodb.com', 'username': 'ykangpark'}

Message: SERVER-64416: view creation returns same error as collection creation
Branch: master
https://github.com/mongodb/mongo/commit/6bd5618937542267553791332394c571973740eb

Comment by Connie Chen [ 15/Mar/22 ]

We still want to investigate if we return inconsistent errors in other cases in addition to namespace collision. We also want to look into whether this error can happen with sharding.
Once this is determined, we should re-triage whether we should complete this ticket.

Generated at Thu Feb 08 06:00:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.