Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions source/release-notes/2.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omit the final example.

Restrictions on Database Names for Windows
``````````````````````````````````````````

Expand Down