[SERVER-4442] It is possible to rename a collection to an empty string Created: 06/Dec/11  Updated: 11/Jul/16  Resolved: 12/Dec/11

Status: Closed
Project: Core Server
Component/s: Usability
Affects Version/s: 2.0.1
Fix Version/s: 2.1.0

Type: Bug Priority: Major - P3
Reporter: Marc Bastien Assignee: Kevin Matulef
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

All


Issue Links:
Related
is related to DOCS-564 2.2.0 release notes should mention br... Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Participants:

 Description   

Mongo does not allow the creation of collections with an empty string as the name, but it is possible to rename an existing collection to "".

To reproduce:

> db[""].save(

{x:2}

) // it is not possible to create a new collection with an empty string as the name
invalid ns: test.
> db.getCollection("").save(

{x:2}

)
invalid ns: test.
> db.test.save(

{x:2}

) // it is possible to rename an existing collection to an empty string
> db.test.renameCollection("")

{ "ok" : 1 }

> db[""].find()

{ "_id" : ObjectId("4ede683f5833a9b2c91c8dc0"), "x" : 2 }

>



 Comments   
Comment by auto [ 12/Dec/11 ]

Author:

{u'login': u'matulef', u'name': u'Kevin Matulef', u'email': u'matulef@gmail.com'}

Message: SERVER-4442 now validates coll names non-empty
Branch: master
https://github.com/mongodb/mongo/commit/21a4dccfaba8bdbfeec87bd576260d8ba8fb462a

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