Skip to content

Commit 1c47996

Browse files
Standardized example header in usage examples (#40)
1 parent 283343a commit 1c47996

File tree

7 files changed

+22
-5
lines changed

7 files changed

+22
-5
lines changed

source/usage-examples/command.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ The ``command()`` method returns a :mdn:`Promise
2828
that resolves to an object containing the return object of the operation
2929
that was run.
3030

31+
Example
32+
-------
3133

3234
.. literalinclude:: /code-snippets/usage-examples/command.js
3335
:language: javascript

source/usage-examples/distinct.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ resembles the following:
3939

4040
"key" had the wrong type. Expected string, found <non-string type>
4141

42-
4342
Example
4443
-------
4544

source/usage-examples/insertMany.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ Specifying incorrect parameters for your ``insertMany()`` operation can
2424
cause problems. Attempting to insert a field to a value that would violate
2525
unique index rules will throw a ``duplicate key error``.
2626

27+
Example
28+
-------
29+
2730
.. literalinclude:: /code-snippets/usage-examples/insertMany.js
2831
:language: javascript
2932
:linenos:

source/usage-examples/insertOne.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ inserted document. The ``insertedCount`` field of this object has a
1717
value of ``0`` if a document was not created, and a value of ``1`` if a
1818
document was created.
1919

20+
Example
21+
-------
22+
2023
.. literalinclude:: /code-snippets/usage-examples/insertOne.js
2124
:language: javascript
2225
:linenos:

source/usage-examples/replaceOne.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ unique index rule, ``replaceOne()`` throws a ``duplicate key error``.
4141
You can configure ``findOneAndReplace()`` to return either the
4242
original matched document or the replacement document.
4343

44+
Example
45+
-------
46+
4447
.. literalinclude:: /code-snippets/usage-examples/replaceOne.js
4548
:language: javascript
4649
:linenos:

source/usage-examples/updateMany.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ The ``updateMany()`` method returns a :mdn:`Promise
1818
that resolves to an object. The ``modifiedCount`` field of this object
1919
shows how many documents were modified.
2020

21+
Example
22+
-------
23+
2124
.. literalinclude:: /code-snippets/usage-examples/updateMany.js
2225
:language: javascript
2326
:linenos:

source/usage-examples/updateOne.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ cause problems. Attempting to modify the immutable field ``_id`` will
2828
result in an error. Additionally, trying to update a field to value that
2929
would violate unique index rules will throw a ``duplicate key error``.
3030

31-
.. literalinclude:: /code-snippets/usage-examples/updateOne.js
32-
:language: javascript
33-
:linenos:
34-
3531
.. note::
3632

3733
If your application requires the document after updating,
3834
consider using the :node-docs:`collection.findOneAndUpdate()
3935
<api/Collection.html#findOneAndUpdate>`. method, which has a similar
4036
interface to ``updateOne()`` but also returns the original or updated
4137
document.
38+
39+
Example
40+
-------
41+
42+
.. literalinclude:: /code-snippets/usage-examples/updateOne.js
43+
:language: javascript
44+
:linenos:
45+

0 commit comments

Comments
 (0)