@@ -18,19 +18,18 @@ MongoDB Java driver using plain old Java objects (`POJOs <https://en.wikipedia.o
18
18
POJOs are often used for data encapsulation, separating business logic from
19
19
data representation.
20
20
21
- In the following sections we show :
21
+ The example in this guide shows how to perform the following :
22
22
23
- - A POJO example
24
- - How to configure the driver to serialize and deserialize POJOs
25
- - Sample code to read and write documents to MongoDB using POJOs
23
+ - Configure the driver to serialize and deserialize POJOs
24
+ - How to read and write to documents using POJOs
26
25
27
26
.. _fundamentals-example-pojo:
28
27
29
28
Example POJO
30
29
------------
31
30
32
- To follow the steps in this guide, you can create your own class or use the
33
- following sample POJO class which describes some characteristics of a flower:
31
+ To follow the steps in this guide, use the following sample POJO class
32
+ which describes characteristics of a flower:
34
33
35
34
.. code-block:: java
36
35
@@ -137,13 +136,12 @@ requirements:
137
136
138
137
CodecProvider pojoCodecProvider = PojoCodecProvider.builder().automatic(true).build();
139
138
140
- .. note::
141
-
142
- Codec providers also contain other objects such as ``ClassModel`` and
143
- ``Convention`` instances that further define serialization behavior.
144
- For more information on codec providers and customization, see our guide
145
- on :doc:`POJO Customization </fundamentals/data-formats/pojo-customization>`.
139
+ .. note::
146
140
141
+ Codec providers also contain other objects such as ``ClassModel`` and
142
+ ``Convention`` instances that further define serialization behavior.
143
+ For more information on codec providers and customization, see our guide
144
+ on :doc:`POJO Customization </fundamentals/data-formats/pojo-customization>`.
147
145
148
146
#. Add the ``PojoCodecProvider`` instance to a ``CodecRegistry``. The
149
147
``CodecRegistry`` allows you to specify one or more codec providers to
@@ -189,12 +187,14 @@ requirements:
189
187
190
188
MongoCollection<Flower> collection = database.getCollection("flowers", Flower.class);
191
189
192
- Once you have configured the preceding ``MongoCollection`` instance, you can:
190
+ Once you have configured the preceding ``MongoCollection`` instance, you
191
+ can perform the following :ref:`CRUD operations <java-crud-operations>`
192
+ with the POJOs:
193
193
194
- - save an instance of the POJO to the collection
195
- - retrieve instances of the POJO from a query on the collection
194
+ - Create a document from a POJO
195
+ - Retrieve data in a POJO instance
196
196
197
- The following code shows how you can insert an instance of ``Flower`` into
197
+ The following code snippet shows how you can insert an instance of ``Flower`` into
198
198
the collection and then retrieve it as a ``List`` of your POJO class objects:
199
199
200
200
.. code-block:: java
0 commit comments