Skip to content

Commit 93c5e27

Browse files
author
Sam Kleinman
committed
DOCS-29 tweak to the count command documentation
1 parent b28ceb3 commit 93c5e27

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

source/reference/commands.txt

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,20 +325,25 @@ Aggregation
325325

326326
.. dbcommand:: count
327327

328-
The :dbcommand:`count` command counts the number of documents in a collection. For example:
328+
The :dbcommand:`count` command counts the number of documents in a
329+
collection. For example:
329330

330331
.. code-block:: javascript
331332

332-
db.collection.count():
333+
> db.runCommand( { count: "collection" } );
334+
{ "n" : 10 , "ok" : 1 }
333335

334-
In the :program:`mongo` shell, this returns the number of documents in the
335-
collection (e.g. ``collection``). You may also run this command
336-
using the :func:`db.runCommand()` functionality, with the following results:
336+
In the :program:`mongo` shell, this returns the number of documents
337+
in the collection (e.g. ``collection``.) You may also use the
338+
:func:`count() <cursor.count()>` method on any cursor object to
339+
return a count of the number of documents in that cursor. The
340+
following operation produces the same result in the
341+
:program:`mongo` shell:
337342

338343
.. code-block:: javascript
339344

340-
> db.runCommand( { count: "collection" } );
341-
{ "n" : 10 , "ok" : 1 }
345+
> db.collection.count():
346+
{ "n" : 10 , "ok" : 1 }
342347

343348
The collection in this example has 10 documents.
344349

0 commit comments

Comments
 (0)