Skip to content

Commit d4ef057

Browse files
committed
DOCS-918 incorporate jeremy's feedback
1 parent d4d5791 commit d4ef057

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

source/reference/method/cursor.forEach.txt

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ cursor.forEach()
44

55
.. default-domain:: mongodb
66

7-
.. method:: cursor.forEach(function)
7+
.. method:: cursor.forEach(<function>)
88

9-
The :method:`~cursor.forEach()` method iterates the cursor
10-
to apply function to each document from the cursor.
9+
The :method:`~cursor.forEach()` method iterates the cursor to apply
10+
a JavaScript ``<function>`` to each document from the cursor.
1111

1212
The :method:`~cursor.forEach()` method accepts the following
1313
argument:
1414

15-
:param function:
15+
:param <function>:
1616

1717
JavaScript function to apply to each document from the
18-
cursor. The function signature includes a single argument
19-
which is passed the current document to process, as in the
18+
cursor. The ``<function>`` signature includes a single argument
19+
that is passed the current document to process, as in the
2020
following prototype:
2121

2222
.. code-block:: javascript
@@ -41,18 +41,12 @@ cursor.forEach()
4141
and thus, you can access ``arguments.length`` attribute to
4242
determine the number of arguments.
4343

44-
Consider the following example which appends the
45-
:method:`~cursor.forEach()` method to a
46-
:method:`~db.collection.find()` query to iterate through the cursor
47-
returned from the :method:`~db.collection.find()` and apply the
48-
function to each document:
44+
The following example invokes the :method:`~cursor.forEach()` method
45+
on the cursor returned by :method:`~db.collection.find()` to print
46+
the name of each user in the collection:
4947

5048
.. code-block:: javascript
5149

5250
db.users.find().forEach( function(myDoc) { print( "user: " + myDoc.name ); } );
5351

54-
The example finds all documents in the ``users`` collection and
55-
applies function to each document in order to print the name from each
56-
document.
57-
5852
.. seealso:: :method:`cursor.map()` for similar functionality.

0 commit comments

Comments
 (0)