Skip to content

Commit 709c650

Browse files
author
Chris Cho
authored
DOCSP-8676 fix grammar and consistency (#51)
* DOCSP-8676 fix grammar and consistency across usage examples
1 parent a1e22d6 commit 709c650

20 files changed

+192
-191
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ build/
77
giza.log
88
.vscode*
99
*.swp
10+
*.code-workspace

source/fundamentals/connection.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The last part of the connection string contains connection and authentication
4646
options as parameters. In the example above, we set two connection options:
4747
``poolSize=20`` and ``useUnifiedTopology=true``.
4848

49-
The code below shows how the sample connection URI could be used in a client to
49+
The code below shows how you can use the sample connection URI in a client to
5050
connect to MongoDB.
5151

5252
.. literalinclude:: /code-snippets/connection/srv.js
@@ -101,8 +101,9 @@ URI to specify the behavior of the client.
101101
* - **validateOptions**
102102
- boolean
103103
- ``false``
104-
- Specifies whether to error when an unknown or incorrect option is
105-
provided. If ``false``, the driver produces warnings only.
104+
- Specifies whether to error when the method parameters contain an
105+
unknown or incorrect option. If ``false``, the driver produces warnings
106+
only.
106107

107108
* - **poolSize**
108109
- integer
@@ -131,7 +132,7 @@ URI to specify the behavior of the client.
131132
* - **keepAlive**
132133
- boolean
133134
- ``true``
134-
- Specifies whether ``keepAlive`` is enabled on the TCP socket. For more
135+
- Specifies whether to enable ``keepAlive`` on the TCP socket. For more
135136
information, see the documentation for `Node.js socket.setKeepAlive
136137
<https://nodejs.org/dist/latest-v10.x/docs/api/net.html#net_socket_setkeepalive_enable_initialdelay>`_.
137138

@@ -200,7 +201,8 @@ URI to specify the behavior of the client.
200201
- boolean
201202
- ``true``
202203
- Specifies whether to promote BSON values to Node.js native types when
203-
possible. When set to false, BSON values are presented as wrapper types.
204+
possible. When set to false, it uses wrapper types to present
205+
BSON values.
204206

205207
* - **pkFactory**
206208
- object
@@ -223,7 +225,7 @@ URI to specify the behavior of the client.
223225
* - **logger**
224226
- object
225227
- ``null``
226-
- Specifies a custom logger to be used by the client.
228+
- Specifies a custom logger for the client to use.
227229

228230
* - **tls**
229231
- boolean

source/fundamentals/crud.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ Aggregate
7373

7474
If you want to create custom processing pipelines for documents in a
7575
collection, you can use ``aggregate()``. This method accepts a
76-
pipeline of aggregation commands that are run in sequence. These
77-
commands let you filter, summarize, and augment documents in a
78-
collection into a result set for viewing.
76+
pipeline of aggregation commands to run in sequence. These commands let
77+
you filter, summarize, and augment documents in a collection into a result
78+
set for viewing.
7979

8080
.. example::
8181

@@ -92,11 +92,10 @@ collection into a result set for viewing.
9292
Watch / Subscribe
9393
~~~~~~~~~~~~~~~~~
9494

95-
If you want to monitor a collection for new, update, replace, and
96-
deleted documents that match a certain criteria, you can use
97-
``watch()``. This method takes a pipeline of aggregation commands that
98-
are run in sequence on new data whenever write operations are run on
99-
the collection.
95+
You can use the ``watch()`` method if you want to monitor a collection for
96+
new, update, replace, and deleted documents that match a certain criteria.
97+
You can pass this method a pipeline of aggregation commands that
98+
sequentially run on new data whenever write operations run on the collection.
10099

101100
.. example::
102101

source/fundamentals/logging.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ level:
5656
Filter on a Specific Class
5757
--------------------------
5858

59-
You can set the Logger to only produce log messages that are reported by
60-
specific classes. The following example demonstrates how to log messages from
61-
only the ``Db`` class.
59+
You can set the Logger to only produce log messages generated by specific
60+
classes. The following example demonstrates how to log messages from the
61+
``Db`` class only.
6262

6363
.. code-block:: js
6464

@@ -74,7 +74,7 @@ only the ``Db`` class.
7474
await db.command({ isMaster: true });
7575
}
7676

77-
The driver classes that can be specified for filtering are as follows:
77+
You can specify the following driver classes for the logging filter:
7878

7979
.. list-table::
8080
:header-rows: 1

source/fundamentals/monitoring.txt

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ Overview
1414
--------
1515

1616
This guide shows you how to monitor topology events in a MongoDB instance,
17-
replica set, or sharded cluster. Topology events, also known as Server
18-
Discovery and Monitoring (SDAM) events, are created by the driver when there is
19-
a change in the state of the instance or cluster that you are connected to.
20-
For example, when a new connection is established or a new primary is elected,
21-
an event is created.
17+
replica set, or sharded cluster. The driver creates topology events, also
18+
known as Server Discovery and Monitoring (SDAM) events, when there is
19+
a change in the state of the instance or cluster that you connected to.
20+
For example, the driver creates an event when you establish a new connection
21+
or if the cluster elects a new primary.
2222

2323
Read this guide if you need to record topology changes in your application or
2424
want to explore the information provided in these events.
@@ -38,8 +38,7 @@ deployment:
3838
Event Descriptions
3939
------------------
4040

41-
The following table lists all the SDAM events that are made available to your
42-
application by the driver:
41+
You can subscribe to any of the following SDAM events:
4342

4443
.. list-table::
4544
:header-rows: 1
@@ -48,24 +47,24 @@ application by the driver:
4847
- Description
4948

5049
* - ``serverOpening``
51-
- Created when a connection to an instance is established.
50+
- Created when a connection to an instance opens.
5251

5352
* - ``serverClosed``
54-
- Created when a connection to an instance is closed.
53+
- Created when a connection to an instance closes.
5554

5655
* - ``serverDescriptionChanged``
5756
- Created when an instance state changes (such as from secondary to
5857
primary).
5958

6059
* - ``topologyOpening``
61-
- Created before any instance connections are attempted.
60+
- Created prior to attempting a connection to an instance.
6261

6362
* - ``topologyClosed``
64-
- Created after all instance connections in the topology are closed.
63+
- Created after all instance connections in the topology close.
6564

6665
* - ``topologyDescriptionChanged``
67-
- Created when the topology changes, such as a new primary being
68-
elected or a **mongos** proxy disconnecting.
66+
- Created when the topology changes, such as an election of a new
67+
primary or a **mongos** proxy disconnecting.
6968

7069
*Not applicable to a single instance.*
7170

@@ -75,8 +74,8 @@ application by the driver:
7574
*Not applicable to a single instance.*
7675

7776
* - ``serverHeartbeatSucceeded``
78-
- Created when a successful response to the ``isMaster`` command is
79-
returned by a MongoDB instance.
77+
- Created when the ``isMaster`` command returns successfully from a
78+
MongoDB instance.
8079

8180
*Not applicable to a single instance.*
8281

@@ -156,8 +155,8 @@ one of the following possible values:
156155
* - ``Mongos``
157156
- Mongos proxy instance
158157
* - ``PossiblePrimary``
159-
- At least one server recognizes this as the primary, but still needs to
160-
be verified
158+
- At least one server recognizes this as the primary, but is not yet
159+
verified by all instances.
161160
* - ``RSPrimary``
162161
- Primary instance
163162
* - ``RSSecondary``

source/usage-examples/bulkWrite.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ documentation for full details.
1515
``bulkWrite()`` accepts the following parameters:
1616

1717
- ``operations``: specifies the bulk operations to
18-
perform. Each operation is passed to ``bulkWrite()`` as an object in
18+
perform. Pass each operation to ``bulkWrite()`` as an object in
1919
an array.
2020

2121
- ``options``: *optional* settings that affect the execution
@@ -57,7 +57,7 @@ same email address.
5757

5858
Error during bulkWrite, BulkWriteError: E11000 duplicate key error collection: sample_mflix.users index: email_1 dup key: { : "rita_91@example.com" }
5959

60-
Similarly, if you attempt to perform a bulk write against a collection
60+
Similarly, if you attempt to perform a bulk write against a collection
6161
that uses :manual:`schema validation </core/schema-validation>`, you may
6262
encounter warnings or errors related to the formatting of inserted or
6363
modified documents.

source/usage-examples/command.txt

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,22 @@ Run a Command
66

77
You can run all raw database operations, not including
88
:manual:`CRUD </crud/>` operations, using the :node-api:`command()
9-
<Admin.html#~command>` method. Typically ``command()`` is used for
10-
diagnostic and administrative tasks, such as fetching server stats or
11-
initializing a replica set.
9+
<Admin.html#~command>` method. Call the ``command()`` method with
10+
your command object on an instance of ``Admin`` for diagnostic and
11+
administrative tasks such as fetching server stats or initializing a replica
12+
set.
1213

1314
.. note::
1415
Use :manual:`collection methods </reference/method/js-collection>`
15-
instead of raw db commands whenever possible.
16+
instead of raw database commands whenever possible.
1617

17-
Create an :mdn:`Object
18-
<Web/JavaScript/Reference/Global_Objects/Object>`
19-
to specify additional options. Set the ``maxTimeMS`` field of this
20-
object to state the number of milliseconds to wait before aborting the
18+
Create an object to specify options. Set the ``maxTimeMS`` field of this
19+
object to state the number of milliseconds to wait before terminating the
2120
query.
2221

2322
The ``command()`` method returns a :mdn:`Promise
24-
<Web/JavaScript/Reference/Global_Objects/Promise>`
25-
that resolves to an object containing the return object of the operation
26-
that was run.
23+
<Web/JavaScript/Reference/Global_Objects/Promise>`. The Promise returns
24+
the results of the command operation when it completes.
2725

2826
Example
2927
-------

source/usage-examples/count.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,14 @@ documents in a collection:
1919
collection metadata.
2020

2121
``estimatedDocumentCount()`` is faster than ``countDocuments()`` because
22-
the estimation is based on the collection's metadata rather than
23-
scanning the collection. In contrast,
24-
``countDocuments()`` takes longer to return, but provides an
25-
**accurate** count of the number of documents and supports specifying a
26-
filter. Choose the appropriate method for your workload.
22+
the estimation uses the collection's metadata rather than scanning the
23+
collection. In contrast, ``countDocuments()`` takes longer to return, but
24+
provides an **accurate** count of the number of documents and supports
25+
specifying a filter. Choose the appropriate method for your workload.
2726

2827
To specify which documents you wish to count, ``countDocuments()``
2928
accepts a :doc:`query </fundamentals/crud/query-document>` parameter.
30-
``countDocuments()`` will only count the documents that match the
31-
specified query.
29+
``countDocuments()`` counts the documents that match the specified query.
3230

3331
``countDocuments()`` and ``estimatedDocumentCount()`` support optional
3432
settings that affect the method's execution. Refer to the reference

source/usage-examples/deleteMany.txt

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,32 @@ Delete Multiple Documents
44

55
.. default-domain:: mongodb
66

7-
You can delete several documents in a collection at once with
8-
``collection.deleteMany()``.
9-
The ``deleteMany()`` method uses a query document that you provide
10-
to match only the subset of the documents in the collection that match
11-
the query. If you don't provide a query document (or if you provide an
12-
empty document), MongoDB matches all documents in the collection. All
13-
matched documents are deleted. While you can use ``deleteMany()`` to
14-
delete all documents in a collection, consider using
15-
:node-api:`drop() <Collection.html#drop>`
16-
instead for better performance and clearer code.
17-
18-
You can define additional query options using the ``options``
19-
object passed as the second parameter of the ``deleteMany()`` method.
20-
You can also pass a
21-
:node-api:`callback method
22-
<Collection.html#~deleteWriteOpCallback>`
23-
as an optional third parameter. For detailed reference documentation,
24-
see
25-
:node-api:`collection.deleteMany() <Collection.html#deleteMany>`.
26-
27-
``deleteMany()`` behaves in two different ways depending on
28-
whether or not a callback method is provided:
29-
30-
- if no callback method is provided, ``deleteMany()`` returns a
7+
You can delete several documents in a collection at once using the
8+
:node-api:`collection.deleteMany() <Collection.html#deleteMany>` method.
9+
Pass a query document to the ``deleteMany()`` method to specify a subset
10+
of documents in the collection to delete. If you do not provide a query
11+
document (or if you provide an empty document), MongoDB matches all documents
12+
in the collection and deletes them. While you can use ``deleteMany()``
13+
to delete all documents in a collection, consider using
14+
:node-api:`drop() <Collection.html#drop>` instead for better performance
15+
and clearer code.
16+
17+
You can specify additional options in the ``options`` object passed in
18+
the second parameter of the ``deleteMany()`` method. You can also pass a
19+
:node-api:`callback method <Collection.html#~deleteWriteOpCallback>`
20+
as an optional third parameter. For more detailed information, see
21+
:node-api:`the deleteMany() API documentation <Collection.html#deleteMany>`.
22+
23+
``deleteMany()`` behaves in two different ways depending on whether you
24+
provide a callback method:
25+
26+
- if you do not specify a callback method, ``deleteMany()`` returns a
3127
:mdn:`Promise <Web/JavaScript/Reference/Global_Objects/Promise>`
32-
that resolves to an
33-
:mdn:`Object <Web/JavaScript/Reference/Global_Objects/Object>`
28+
that resolves to an object
3429

35-
- if a callback method is provided, ``deleteMany()`` returns
36-
nothing, and instead passes the result object or error object to the
37-
provided callback method
30+
- if you specify a callback method, ``deleteMany()`` returns
31+
nothing, and instead passes the result or error object to the
32+
callback method
3833

3934
The
4035
:node-api:`result object <Collection.html#~deleteWriteOpResult>`
@@ -50,7 +45,7 @@ Example
5045

5146
The following snippet deletes multiple documents from the ``movies``
5247
collection. It uses a **query document** that configures the query to
53-
match and delete only movies with the title "Santa Claus".
48+
match and delete movies with the title "Santa Claus".
5449

5550
.. literalinclude:: /code-snippets/usage-examples/deleteMany.js
5651
:language: javascript

source/usage-examples/deleteOne.txt

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,35 @@ Delete a Document
77
You can delete a single document in a collection with
88
``collection.deleteOne()``.
99
The ``deleteOne()`` method uses a query document that you provide
10-
to match only the subset of the documents in the collection that match
11-
the query. If you don't provide a query document (or if you provide an
12-
empty document), MongoDB matches all documents in the collection.
13-
However, only the first matched document is deleted.
10+
to match the subset of the documents in the collection that match
11+
the query. If you do not provide a query document (or if you provide an
12+
empty document), MongoDB matches all documents in the collection and
13+
deletes the first match.
1414

15-
You can define additional query options using the
15+
You can specify additional query options using the
1616
``options`` object passed as the second parameter of the
1717
``deleteOne`` method. You can also pass a
1818
:node-api:`callback method <Collection.html#~deleteWriteOpCallback>`
1919
as an optional third parameter. For detailed reference documentation,
20-
see :node-api:`collection.deleteOne() <Collection.html#deleteOne>`.
20+
see :node-api:`deleteOne() <Collection.html#deleteOne>`.
2121

2222
``deleteOne()`` behaves in two different ways depending on
23-
whether or not a callback method is provided:
23+
whether you provide a callback method:
2424

25-
- if no callback method is provided, ``deleteOne()`` returns a
25+
- if you do not specify a callback method, ``deleteOne()`` returns a
2626
:mdn:`Promise <Web/JavaScript/Reference/Global_Objects/Promise>`
27-
that resolves to an
28-
:mdn:`Object <Web/JavaScript/Reference/Global_Objects/Object>`
27+
that resolves to an object
2928

30-
- if a callback method is provided, ``deleteOne()`` returns
29+
- if you specify a callback method, ``deleteOne()`` returns
3130
nothing, and instead passes the result object or error object to the
32-
provided callback method
31+
callback method
3332

3433
The :node-api:`result object
3534
<Collection.html#~deleteWriteOpResult>`
3635
contains several keys in the event of a successful execution. You can
3736
use the ``deletedCount`` key to check the number of documents deleted by
38-
the operation. Since ``deleteOne()`` can only delete a single document,
39-
``deletedCount`` can only have a value of ``0`` or ``1``.
37+
the operation. Since ``deleteOne()`` can only delete a single document,
38+
``deletedCount`` can have a value of either ``0`` or ``1``.
4039

4140
The error object contains ``errmsg``, a human-readable explanation of
4241
what caused the operation to fail.

0 commit comments

Comments
 (0)