Skip to content

DOCS-18789 Correcting case sensitivity limitation blurb #5877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
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
31 changes: 31 additions & 0 deletions source/includes/fact-case-sensitivity-limitation-code.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

.. example::

If the database ``salesDB`` already exists MongoDB will
return an error if if you attempt to create a database named ``salesdb``.

.. code-block:: javascript

mixedCase = db.getSiblingDB('salesDB')
lowerCase = db.getSiblingDB('salesdb')

mixedCase.retail.insertOne({ "widgets": 1, "price": 50 })

The operation succeeds and :method:`~db.collection.insertOne()` implicitly
creates the ``SalesDB`` database.

.. code-block:: javascript

lowerCase.retail.insertOne({ "widgets": 1, "price": 50 })

The operation fails. :method:`~db.collection.insertOne()` tries to
create a ``salesdb`` database and is blocked by the naming
restriction. Database names must differ on more than just case.

.. code-block:: javascript

lowerCase.retail.find()

This operation does not return any results because the database names are case
sensitive. There is no error because :method:`~db.collection.find()` doesn't
implicitly create a new database.
7 changes: 5 additions & 2 deletions source/reference/limits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ Naming Restrictions

.. limit:: Database Name Case Sensitivity

Since database names are case *insensitive* in MongoDB, database
names cannot differ only by the case of the characters.
Database names are case-sensitive in MongoDB. They also have an
additional restriction, case cannot be the only difference between
database names.

.. include:: /includes/fact-case-sensitivity-limitation-code.rst

.. limit:: Restrictions on Database Names for Windows

Expand Down