Skip to content

Commit c4e2934

Browse files
committed
edits
1 parent 2aa1742 commit c4e2934

File tree

4 files changed

+45
-31
lines changed

4 files changed

+45
-31
lines changed

source/connection/connect.txt

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
Connect to MongoDB
55
==================
66

7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
713
.. facet::
814
:name: genre
915
:values: reference
@@ -218,21 +224,28 @@ introduced in Java 9.
218224
Which type of ``MongoClient`` should I use?
219225
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
220226

221-
New applications generally use the
222-
``com.mongodb.client.MongoClient`` interface, which supports:
227+
New applications generally use the ``com.mongodb.client.MongoClient`` interface,
228+
which supports the following features:
223229

224-
- Configuration with ``MongoClientSettings`` and ``ConnectionString``. You can create instances of this interface via factory methods defined in the ``com.mongodb.client.MongoClients`` class.
225-
- CRUD API using ``MongoDatabase``, and from there, ``MongoCollection``
230+
- Configuration with ``MongoClientSettings`` and ``ConnectionString``. You can create
231+
instances of this interface by using factory methods defined in the ``com.mongodb.client.MongoClients``
232+
class.
233+
- Access to the CRUD API by using ``MongoDatabase``, and from there, ``MongoCollection``.
226234

227-
Use the ``com.mongodb.MongoClient`` class if you require support for the legacy API, which supports:
235+
Use the ``com.mongodb.MongoClient`` class if you require support for the legacy API, which supports
236+
the following features:
228237

229-
- Configuration with ``MongoClientOptions`` and ``MongoClientURI``
230-
- CRUD API using ``DB``, and from there, ``DBCollection``. You can access this API via the ``getDB()`` method.
238+
- Configuration by using ``MongoClientOptions`` and ``MongoClientURI``.
239+
- Access to the CRUD API by using ``DB``, and from there, ``DBCollection``. You can access this API
240+
by using the ``getDB()`` method.
231241

232-
For applications that require a mix of the new and legacy APIs, ``com.mongodb.MongoClient`` also supports:
242+
For applications that require a mix of the new and legacy APIs, ``com.mongodb.MongoClient`` also supports
243+
the following features:
233244

234-
- Configuration with ``MongoClientSettings`` and ``ConnectionString``, the only difference being that you create instances via constructors instead of a factory class.
235-
- CRUD API using ``MongoDatabase``, and from there, ``MongoCollection``. You can access this API via the ``getDatabase()`` method.
245+
- Configuration by using ``MongoClientSettings`` and ``ConnectionString``, the only difference
246+
being that you create instances via constructors instead of a factory class.
247+
- Access to the CRUD API using ``MongoDatabase``, and from there, ``MongoCollection``. You can access this
248+
API by using the ``getDatabase()`` method.
236249

237250
How do I prevent the "java.lang.NoClassDefFoundError: com/mongodb/MongoClient" error?
238251
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

source/data-formats/document-data-format-bson.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,13 @@ your project by downloading the JAR file directly from the
9393
Frequently Asked Questions
9494
--------------------------
9595

96-
This section answers questions that may arise about
97-
the BSON data format.
96+
This section answers questions that may arise when using the BSON data format.
9897

9998
How do I prevent the "IllegalArgumentException: Invalid BSON field name" error?
10099
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101100

102101
Your application might throw this exception if you pass an incorrectly formatted
103-
document to an operation and you are using a driver version v4.7 or earlier.
102+
document to an operation and you are using {+driver-short+} v4.7 or earlier.
104103

105104
.. note::
106105

@@ -123,8 +122,8 @@ example:
123122

124123
To avoid this error, use the builder class for the appropriate operation.
125124
The driver offers builder classes to create syntactically correct BSON for
126-
MongoDB operations. The prior example can be correctly expressed using
127-
the builder classes as shown in the following code example:
125+
MongoDB operations. The preceding example can be correctly expressed using
126+
the builder classes, as shown in the following code example:
128127

129128
.. code-block:: java
130129
:emphasize-lines: 7
@@ -138,4 +137,4 @@ the builder classes as shown in the following code example:
138137

139138
collection.updateOne(eq("name", "fizz"), set("name", "buzz"));
140139

141-
To learn more about the available builders classes, see the :ref:`<java-builders>` documentation.
140+
To learn more about the available builders classes, see the :ref:`<java-builders>` guide.

source/data-formats/pojo-customization.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,8 @@ No, the ``PojoCodecProvider`` automatically generates an ObjectId.
775775
Can the ID field be a compound key?
776776
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
777777

778-
Yes. For an example of this, see `our implementation <https://github.com/niccottrell/mongo-java-tests/blob/master/src/test/PojoCompoundIdTest.java>`_
778+
Yes. For an example of this, see `our implementation <https://github.com/niccottrell/mongo-java-tests/blob/master/src/test/PojoCompoundIdTest.java>`__
779+
in Github.
779780

780781
Can I use polymorphism in a POJO accessor?
781782
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -786,8 +787,8 @@ Yes, by using a discriminator. For more information, see the :ref:`Discriminator
786787
Can I control serialization of ``LocalDate``?
787788
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
788789

789-
Yes, the 3.7 Java driver adds native support for ``JSR-310 Instant``,
790-
``LocalDate`` & ``LocalDateTime``.
790+
Yes, the {+driver-short+} v3.7 adds native support for ``JSR-310 Instant``,
791+
``LocalDate`` and ``LocalDateTime``.
791792

792793
Can I serialize a ``java.util.Date`` as a string in format **yyyy-mm-dd**?
793794
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -814,7 +815,7 @@ reflection if no public setter is available.
814815
Can I mix private, protected, and public setters and getters?
815816
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
816817

817-
No. The native POJO codec assumes that getters/setters have the same
818+
No. The native POJO codec assumes that getters and setters have the same
818819
modifiers for each field.
819820

820821
For example, the following methods throws an exception during encoding:
@@ -828,12 +829,13 @@ How do I fix: "org.bson.codecs.configuration.CodecConfigurationException: Can't
828829
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
829830

830831
This exception means you must register a codec for the class since
831-
there is none at the moment.
832+
none exist.
832833

833834
How do I specify the collection name for a particular POJO class? Is there an annotation?
834835
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
835836

836-
There is no annotation. We recommend adding a static string in your class as shown:
837+
There is no annotation. We recommend adding a static string in your class as shown
838+
in the following code:
837839

838840
.. code-block:: java
839841

source/versioning/legacy.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,19 @@ Frequently Asked Questions
172172

173173
This section answers questions that may arise about the legacy API.
174174

175-
How do I connect to my MongoDB instance with the legacy API?
176-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
175+
How do I connect to my MongoDB instance by using the legacy API?
176+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
177177

178-
The following example shows how to connect to a MongoDB instance with the
179-
legacy API and the current API.
180-
181-
Imagine we are connecting to a collection that contains only this document:
178+
Imagine we are connecting to a collection that contains only the following document:
182179

183180
.. code-block:: json
184181
:copyable: false
185182

186183
{"_id": 1, "val": 1}
187184

185+
The following example shows how to connect to this MongoDB collection by using
186+
the legacy API and the current API:
187+
188188
.. tabs::
189189

190190
.. tab:: Legacy API
@@ -227,10 +227,10 @@ see the following API documentation pages:
227227
See the :ref:`Migrate from the Legacy API <java-legacy-api>` page
228228
for a list of differences between the legacy and current API.
229229

230-
How do I use the legacy ``MongoClientOptions`` and ``MongoClientURI`` Classes?
230+
How do I use the legacy ``MongoClientOptions`` and ``MongoClientURI`` classes?
231231
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
232232

233-
Here is an example showing how to use the legacy ``MongoClientOptions`` and
233+
The following example shows how to use the legacy ``MongoClientOptions`` and
234234
``MongoClientURI`` classes to set your write concern:
235235

236236
.. tabs::
@@ -254,7 +254,7 @@ Here is an example showing how to use the legacy ``MongoClientOptions`` and
254254
:end-before: end current-api-mongoclientsettings-example
255255

256256
For more information about the legacy classes and methods used in the preceding example,
257-
see the following API Documentation pages:
257+
see the following API documentation:
258258

259259
- `Legacy API documentation <{+api+}/apidocs/mongodb-driver-legacy/index.html>`__
260260
- `MongoClient <{+api+}/apidocs/mongodb-driver-legacy/com/mongodb/MongoClient.html>`__

0 commit comments

Comments
 (0)