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

It is possible to rename a collection to an empty string

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Done
    • 2.0.1
    • 2.1.0
    • Usability
    • None
    • All
    • Minor Change
    • 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

              matulef Kevin Matulef
              mbastien Marc Bastien
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: