@@ -91,7 +91,7 @@ methods. These methods are not used specifically in this tutorial, but they are
91
91
helpful to reference when getting started with Mongoose.
92
92
93
93
exists()
94
- `````` ``
94
+ ~~~~~~ ``
95
95
96
96
The ``exists()`` method returns either ``null`` or the ``ObjectId`` of a document that
97
97
matches the provided query. The following is an example of matching an article
@@ -107,7 +107,7 @@ For more information, see the `Model.exists()
107
107
Mongoose API documentation.
108
108
109
109
where()
110
- `````` `
110
+ ~~~~~~ `
111
111
112
112
The ``where()`` method allows you to chain and build queries. The following is
113
113
an example of performing a find operation by using ``findOne()`` and the equivalent
@@ -149,18 +149,17 @@ In this tutorial, you will perform the following actions:
149
149
- Validate your data
150
150
- Use multiple schemas and middleware
151
151
152
- Prerequisites
153
- ~~~~~~~~~~~~~
152
+ .. procedure::
153
+ :style: connected
154
154
155
- Before you begin this tutorial, perform the following actions:
155
+ .. step:: Prerequisites
156
156
157
- - Set up a MongoDB Atlas account and configure a cluster.
158
- To view instructions, see the :atlas:`Get Started with Atlas
159
- </getting-started>` guide.
160
- - Install `Node.js <https://nodejs.org/en/download>`__ {+min-node-version+} or later.
157
+ Before you begin this tutorial, perform the following actions:
161
158
162
- .. procedure::
163
- :style: connected
159
+ - Set up a MongoDB Atlas account and configure a cluster. To view
160
+ instructions, see the :atlas:`Get Started with Atlas </getting-started>`
161
+ guide.
162
+ - Install `Node.js <https://nodejs.org/en/download>`__ {+min-node-version+} or later.
164
163
165
164
.. step:: Set up your environment.
166
165
@@ -226,7 +225,7 @@ Before you begin this tutorial, perform the following actions:
226
225
perform CRUD operations using Mongoose.
227
226
228
227
Insert Data
229
- ````````````
228
+ ~~~~~~~~~~~
230
229
231
230
Go to ``index.js`` and add the following import statement to the top of your file:
232
231
@@ -280,7 +279,7 @@ Before you begin this tutorial, perform the following actions:
280
279
insert multiple articles into your database.
281
280
282
281
Update Data
283
- ````````````
282
+ ~~~~~~~~~~~~
284
283
285
284
To update data, you can directly edit the local object with Mongoose.
286
285
Then, you can use the ``save()`` method to write the update to the
@@ -313,7 +312,7 @@ Before you begin this tutorial, perform the following actions:
313
312
}
314
313
315
314
Find Data
316
- ``````````
315
+ ~~~~~~~~~~
317
316
318
317
To find a specific document, you can use the Mongoose ``findById()``
319
318
method to get a document by its ``ObjectId``.
@@ -354,7 +353,7 @@ Before you begin this tutorial, perform the following actions:
354
353
documentation.
355
354
356
355
Specify Document Fields
357
- ```````````````````````
356
+ ~~~~~~~~~~~~~~~~~~~~~~~
358
357
359
358
You can use Mongoose to project only the
360
359
fields that you need. The following code specifies to only project the
@@ -384,7 +383,7 @@ Before you begin this tutorial, perform the following actions:
384
383
}
385
384
386
385
Delete Data
387
- ```````````
386
+ ~~~~~~~~~~~
388
387
389
388
Mongoose uses the ``deleteOne()`` and ``deleteMany()`` methods to delete
390
389
data from a collection. You can specify the field of the document you want
0 commit comments