Skip to content

Commit 2b1f4ce

Browse files
ianf-mongodbnpentrel
authored andcommitted
DOCS-18789 Correcting case sensitivity limitation blurb
1 parent 3f535ce commit 2b1f4ce

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
.. example::
3+
4+
If the database ``salesDB`` already exists MongoDB will
5+
return an error if if you attempt to create a database named ``salesdb``.
6+
7+
.. code-block:: javascript
8+
9+
mixedCase = db.getSiblingDB('salesDB')
10+
lowerCase = db.getSiblingDB('salesdb')
11+
12+
mixedCase.retail.insertOne({ "widgets": 1, "price": 50 })
13+
14+
The operation succeeds and :method:`~db.collection.insertOne()` implicitly
15+
creates the ``SalesDB`` database.
16+
17+
.. code-block:: javascript
18+
19+
lowerCase.retail.insertOne({ "widgets": 1, "price": 50 })
20+
21+
The operation fails. :method:`~db.collection.insertOne()` tries to
22+
create a ``salesdb`` database and is blocked by the naming
23+
restriction. Database names must differ on more than just case.
24+
25+
.. code-block:: javascript
26+
27+
lowerCase.retail.find()
28+
29+
This operation does not return any results because the database names are case
30+
sensitive. There is no error because :method:`~db.collection.find()` doesn't
31+
implicitly create a new database.

source/reference/limits.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ Naming Restrictions
3636

3737
.. limit:: Database Name Case Sensitivity
3838

39-
Since database names are case *insensitive* in MongoDB, database
40-
names cannot differ only by the case of the characters.
39+
Database names are case-sensitive in MongoDB. They also have an
40+
additional restriction, case cannot be the only difference between
41+
database names.
42+
43+
.. include:: /includes/fact-case-sensitivity-limitation-code.rst
4144

4245
.. limit:: Restrictions on Database Names for Windows
4346

0 commit comments

Comments
 (0)