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

It is possible to rename a collection to an empty string

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.1.0
    • Component/s: Usability
    • Labels:
      None
    • Environment:
      All
    • Backwards Compatibility:
      Minor Change
    • Operating System:
      ALL

      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 }

      >

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: