Skip to content

Commit 08a5972

Browse files
committed
DOCS-10863: Improve documentation on use of reserved words in MongoDB shell
1 parent 7c8e6fe commit 08a5972

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

source/mongo.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,22 +116,22 @@ the :method:`~db.collection.insertOne()` operation:
116116
db.myCollection.insertOne( { x: 1 } );
117117

118118
The :method:`db.myCollection.insertOne() <db.collection.insertOne()>` is one
119-
of the :doc:`methods available in the mongo shell </reference/method>`
119+
of the :doc:`methods available in the mongo shell </reference/method>`.
120120

121121
- ``db`` refers to the current database.
122122

123123
- ``myCollection`` is the name of the collection.
124124

125-
If the :program:`mongo` shell does not accept the name of the
126-
collection, for instance if the name contains a space, hyphen, or
127-
starts with a number, you can use an alternate syntax to refer to the
128-
collection, as in the following:
125+
If the :program:`mongo` shell does not accept the name of a collection,
126+
you can use the alternative :method:`db.getCollection()` syntax.
127+
For instance, if a collection name contains a space or hyphen, starts
128+
with a number, or conflicts with a built-in function:
129129

130130
.. code-block:: javascript
131131

132-
db["3test"].find()
133-
134-
db.getCollection("3test").find()
132+
db.getCollection("3 test").find()
133+
db.getCollection("3-test").find()
134+
db.getCollection("stats").find()
135135

136136
.. include:: /includes/fact-mongo-prompt-size.rst
137137

0 commit comments

Comments
 (0)