diff --git a/source/release-notes/2.2.txt b/source/release-notes/2.2.txt index 8f1951d10da..89a07d4ad27 100644 --- a/source/release-notes/2.2.txt +++ b/source/release-notes/2.2.txt @@ -303,6 +303,52 @@ See: :issue:`SERVER-6961` for more information. Behavioral Changes ~~~~~~~~~~~~~~~~~~ +Restrictions on Collection Names +```````````````````````````````` + +In version 2.2, collection names cannot contain the ``$`` character. The +character is still allowed for collection names in MongoDB versions +prior to 2.2. + +The following is a full list of collection-name restrictions. Collection +names can be any UTF-8 string with the following exceptions: + +- A collection name should begin with a letter or an underscore. + +- The empty string (``""``) is not a valid collection name. + +- Collection names cannot contain the ``$`` character. (version 2.2 only) + +- Collection names cannot contain the null character: ``\0`` + +- Do not name a collection using the ``system.`` prefix. The ``system.`` + prefix is reserved for system collections, such as the + ``system.indexes`` collection. + +- The maximum size of a collection name is 128 characters, including the + name of the db and indexes. A best practice is to keep your collection + names below 80 characters. + +If your collection name includes special characters, such as the +underscore character, then to access the collection use the +:method:`db.getCollection()` method or a :api:`similar method for your +driver <>`. + +.. example:: To create a collection ``_foo`` and populate it with + document ``{ a : 1 }``, you would issue the following command: + + .. code-block:: javascript + + db.getCollection("_foo").insert( { a : 1 } ) + + To query the collection, you would issue the following command and + get the following result: + + .. code-block:: javascript + + db.getCollection("_foo").find() + { "_id" : ObjectId("506dbf800f70bf70d1ca613b"), "a" : 1 } + Restrictions on Database Names for Windows ``````````````````````````````````````````