Skip to content

Commit dfe6995

Browse files
committed
steps test
1 parent df13c4a commit dfe6995

File tree

1 file changed

+52
-51
lines changed

1 file changed

+52
-51
lines changed

source/integrations/mongoose-get-started.txt

Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Mongoose is an Object Data Modeling (ODM) library for MongoDB. You can use
2525
Mongoose to help with data modeling, schema enforcement, model validation, and
2626
general data manipulation. Because MongoDB has a flexible data model that allows
2727
you to alter and update databases in the future, there aren't rigid schemas.
28-
Mongoose enforces a semi-regid schema from the beginning. When you use Mongoose,
28+
However, Mongoose enforces a semi-rigid schema from the beginning, so
2929
you must define a schema and model.
3030

3131
In this tutorial, you will perform the following actions:
@@ -99,76 +99,77 @@ Before you begin this tutorial, perform the following actions:
9999
</getting-started>` guide.
100100
- Install `Node.js <https://nodejs.org/en/download>`__ {+min-node-version+} or later.
101101

102-
Set Up Your Environment
103-
-----------------------
102+
.. procedure::
103+
:style: connected
104104

105-
This tutorial uses npm to install dependencies and nodemon to run the code
106-
locally. Run the following commands in your terminal to initialize your project
107-
and install the necessary dependencies:
105+
.. step:: Set up your environment.
108106

109-
.. code-block:: bash
107+
This tutorial uses npm to install dependencies and nodemon to run the code
108+
locally. Run the following commands in your terminal to initialize your
109+
project and install the necessary dependencies:
110110

111-
mkdir mongodb-mongoose
112-
cd mongodb-mongoose
113-
npm init -y
114-
npm i mongoose
115-
npm i -D nodemon
111+
.. code-block:: bash
116112

117-
Open your project in your preferred code editor. This tutorial uses ES Modules
118-
instead of CommonJS. You must add the ``module`` type to use ES Modules. Go to
119-
the ``package.json`` file and add the following code:
113+
mkdir mongodb-mongoose
114+
cd mongodb-mongoose
115+
npm init -y
116+
npm i mongoose
117+
npm i -D nodemon
120118

121-
.. code-block:: json
119+
Open your project in your preferred code editor. This tutorial uses ES
120+
Modules instead of CommonJS. You must add the ``module`` type to use ES
121+
Modules. Go to the ``package.json`` file and add the following code:
122122

123-
...
124-
"scripts": {
125-
"dev": "nodemon index.js"
126-
},
127-
"type": "module",
128-
...
123+
.. code-block:: json
129124

130-
Connect to MongoDB
131-
------------------
125+
...
126+
"scripts": {
127+
"dev": "nodemon index.js"
128+
},
129+
"type": "module",
130+
...
132131

133-
In the root level of your project, create a file named ``index.js`` and add the
134-
following code to the top of the file:
132+
.. step:: Connect to MongoDB
135133

136-
.. code-block:: javascript
134+
In the root level of your project, create a file named ``index.js`` and
135+
add the following code to the top of the file:
137136

138-
import mongoose from 'mongoose';
137+
.. code-block:: javascript
139138

140-
mongoose.connect("<connection string>")
139+
import mongoose from 'mongoose';
141140

142-
Replace the ``<connection string>`` placeholder with your MongoDB Atlas
143-
connection string. For more information on how to find your connection string,
144-
see the :atlas:`Connect to Your Cluster </tutorial/connect-to-your-cluster>`
145-
tutorial in the Atlas documentation.
141+
mongoose.connect("<connection string>")
146142

147-
Create a Schema and Model
148-
-------------------------
143+
Replace the ``<connection string>`` placeholder with your MongoDB Atlas
144+
connection string. For more information on how to find your connection
145+
string, see the :atlas:`Connect to Your Cluster
146+
</tutorial/connect-to-your-cluster>` tutorial in the Atlas documentation.
149147

150-
Before you start adding and updating data in MongoDB, you must create a schema
151-
and model.
148+
.. step:: Create a Schema and Model
152149

153-
With Mongoose, you create a schema model file for each schema that is needed. To
154-
do this, use the folder/file structure. Create the ``model/Blog.js``
155-
folder/file. Open this file and add the following code:
150+
Before you start adding and updating data in MongoDB, you must create a
151+
schema and model.
156152

157-
.. literalinclude:: /includes/integrations/mongoose-blogSchema.js
158-
:language: javascript
159-
:dedent:
153+
With Mongoose, you create a schema model file for each schema that is
154+
needed. To do this, use the folder/file structure. Create the
155+
``model/Blog.js`` folder/file. Open this file and add the following code:
160156

161-
Perform CRUD Operations
162-
-----------------------
157+
.. literalinclude:: /includes/integrations/mongoose-blogSchema.js
158+
:language: javascript
159+
:dedent:
163160

164-
You now have your first model and schema set up, and you can start inserting
165-
data into the database. The following sections show you how to perform CRUD
166-
operations using Mongoose.
161+
.. step:: Perform CRUD Operations
167162

168-
Insert Data
169-
~~~~~~~~~~~
163+
You now have your first model and schema set up, and you can start
164+
inserting data into the database. The following sections show you how to
165+
perform CRUD operations using Mongoose.
166+
167+
.. procedure::
168+
:style: connected
169+
170+
.. step:: Insert Data
170171

171-
Go to ``index.js`` and add the following import statement to the top of your file:
172+
Go to ``index.js`` and add the following import statement to the top of your file:
172173

173174
.. literalinclude:: /includes/integrations/mongoose-get-started-blogSchema.js
174175
:language: javascript

0 commit comments

Comments
 (0)