Skip to content

Commit 88db121

Browse files
committed
DOCSP-48376: Get Started edits
1 parent 127140a commit 88db121

4 files changed

+93
-50
lines changed

source/get-started.txt

Lines changed: 93 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. _node-get-started:
22

3-
============================
4-
Getting Started with Node.js
5-
============================
3+
=======================================
4+
Getting Started with the Node.js Driver
5+
=======================================
66

77
.. facet::
88
:name: genre
@@ -22,19 +22,19 @@ Overview
2222
--------
2323

2424
This guide shows you how to create an application that uses the
25-
{+driver-long+} to connect to a MongoDB cluster hosted on MongoDB Atlas. If
26-
you prefer to connect to MongoDB using a different driver or programming
27-
language, see our :driver:`list of official drivers <>`.
28-
25+
{+driver-long+} to connect to a MongoDB cluster hosted on MongoDB Atlas.
2926
The {+driver-short+} is a library of functions that you can use to connect
3027
to and communicate with MongoDB.
3128

32-
MongoDB Atlas is a fully managed cloud database service that hosts your
33-
MongoDB deployments. You can create your own free (no credit card
34-
required) MongoDB Atlas deployment by following the steps in this guide.
29+
.. tip::
30+
31+
MongoDB Atlas is a fully managed cloud database service that hosts your
32+
MongoDB deployments. You can create your own free (no credit card
33+
required) MongoDB Atlas deployment by following the steps in this guide.
3534

3635
Follow the steps in this guide to connect a sample Node.js application to
37-
a MongoDB Atlas deployment.
36+
a MongoDB Atlas deployment. If you prefer to connect to MongoDB using a different
37+
driver or programming language, see our :driver:`list of official drivers <>`.
3838

3939
.. _node-quick-start-download-and-install:
4040
.. _node-get-started-download-and-install:
@@ -45,15 +45,19 @@ Download and Install
4545
.. procedure::
4646
:style: connected
4747

48-
.. step:: Install Node and npm
48+
.. step:: Install dependencies
4949

50-
Ensure you have Node.js {+min-node-version+} or later and
51-
npm (Node Package Manager) installed in your development environment.
50+
Ensure you have the following dependencies installed in
51+
your development environment:
52+
53+
- Node.js {+min-node-version+} or later
54+
- npm (Node Package Manager)
5255

53-
For information on how to install Node.js and npm, see
54-
`downloading and installing Node.js and npm <https://docs.npmjs.com/downloading-and-installing-node-js-and-npm>`__.
56+
To learn how to install Node.js and npm, see
57+
`Downloading and installing Node.js and npm <https://docs.npmjs.com/downloading-and-installing-node-js-and-npm>`__
58+
in the npm documentation.
5559

56-
.. step:: Create a Project Directory
60+
.. step:: Create a project directory
5761

5862
In your shell, run the following command to create a
5963
directory called ``node_quickstart`` for this project:
@@ -62,27 +66,21 @@ Download and Install
6266

6367
mkdir node_quickstart
6468

65-
Run the following command to navigate into the project
66-
directory:
69+
Then, run the following commands to navigate into the
70+
directory and initialize your Node.js project:
6771

6872
.. code-block:: bash
6973

7074
cd node_quickstart
71-
72-
Run the following command to initialize your Node.js project:
73-
74-
.. code-block:: bash
75-
7675
npm init -y
77-
78-
When this command successfully completes, you have a ``package.json``
76+
77+
When the initialization command successfully completes, you have a ``package.json``
7978
file in your ``node_quickstart`` directory.
8079

81-
8280
.. step:: Install the Node.js Driver
8381

84-
Run the following command in your shell to install
85-
the driver in your project directory:
82+
Run the following command from your project directory to install
83+
the driver:
8684

8785
.. code-block:: bash
8886

@@ -94,10 +92,8 @@ Download and Install
9492
- Saves the package in the ``node_modules`` directory
9593
- Records the dependency information in the ``package.json`` file
9694

97-
After you complete these steps, you have Node.js and npm installed
98-
and a new project directory with the driver dependencies installed.
99-
100-
.. include:: /includes/quick-start/troubleshoot.rst
95+
After you complete these steps, you have a new project directory with
96+
the driver dependencies installed.
10197

10298
.. _node-quick-start-create-deployment:
10399
.. _node-get-started-create-deployment:
@@ -112,13 +108,13 @@ your MongoDB database in the cloud.
112108
.. procedure::
113109
:style: connected
114110

115-
.. step:: Create a Free MongoDB deployment on Atlas
111+
.. step:: Create a free MongoDB deployment on Atlas
116112

117113
Complete the :atlas:`Get Started with Atlas </getting-started?tck=docs_driver_nodejs>`
118114
guide to set up a new Atlas account and load sample data into a new free
119115
tier MongoDB deployment.
120116

121-
.. step:: Save your Credentials
117+
.. step:: Save your credentials
122118

123119
After you create your database user, save that user's
124120
username and password to a safe location for use in an upcoming step.
@@ -127,7 +123,53 @@ After you complete these steps, you have a new free tier MongoDB
127123
deployment on Atlas, database user credentials, and sample data loaded
128124
in your database.
129125

130-
.. include:: /includes/quick-start/troubleshoot.rst
126+
.. _node-quick-start-connection-string:
127+
.. _node-get-started-connection-string:
128+
129+
Create a Connection String
130+
--------------------------
131+
132+
You can connect to your MongoDB deployment by providing a
133+
**connection URI**, also called a *connection string*, which
134+
instructs the driver on how to connect to a MongoDB deployment
135+
and how to behave while connected.
136+
137+
The connection string includes the hostname or IP address and
138+
port of your deployment, the authentication mechanism, user credentials
139+
when applicable, and connection options.
140+
141+
.. procedure::
142+
:style: connected
143+
144+
.. step:: Find your MongoDB Atlas connection string
145+
146+
To retrieve your connection string for the deployment that
147+
you created in the :ref:`previous section <node-get-started-create-deployment>`,
148+
log into your Atlas account and navigate to the
149+
:guilabel:`Clusters` section and click the :guilabel:`Connect` button
150+
for your new deployment.
151+
152+
.. figure:: /includes/figures/atlas_connection_connect_cluster.png
153+
:alt: The connect button in the clusters section of the Atlas UI
154+
155+
.. step:: Copy your connection string
156+
157+
Click the button on the right of the connection string to copy it to
158+
your clipboard, as shown in the following screenshot:
159+
160+
.. figure:: /includes/figures/atlas_connection_copy_string_node.png
161+
:alt: The connection string copy button in the Atlas UI
162+
163+
.. step:: Update the placeholders
164+
165+
Paste your connection string into a file in your preferred text editor
166+
and replace the ``username`` and ``<db_password>`` placeholders with your
167+
database user's username and password.
168+
169+
Save this file to a safe location for use in the next section.
170+
171+
After completing these steps, you have a connection string that
172+
contains your database username, database password, and database name.
131173

132174
.. _node-quick-start-connect-to-mongodb:
133175
.. _node-get-started-connect-to-mongodb:
@@ -138,10 +180,10 @@ Connect to MongoDB
138180
.. procedure::
139181
:style: connected
140182

141-
.. step:: Create your Node.js Application
183+
.. step:: Create your Node.js application
142184

143-
Create a file to contain your application called ``index.js`` in your
144-
``node_quickstart`` project directory.
185+
In your ``node_quickstart`` directory, create a file called
186+
``index.js`` to contain your application.
145187

146188
Copy and paste the following code into the ``index.js`` file:
147189

@@ -171,21 +213,22 @@ Connect to MongoDB
171213
}
172214
run().catch(console.dir);
173215

174-
.. step:: Assign the Connection String
216+
.. step:: Assign the connection string
175217

176218
Replace the ``<connection string uri>`` placeholder with the
177219
connection string that you copied from the :ref:`node-quick-start-connection-string`
178220
step of this guide.
179221

180-
.. step:: Run your Node.js Application
222+
.. step:: Run your Node.js application
181223

182-
In your shell, run the following command to start this application:
224+
From your project directory, run the following command to start
225+
the application:
183226

184227
.. code-block:: none
185228

186229
node index.js
187230

188-
The output includes details of the retrieved movie document:
231+
The output includes details about the retrieved movie document:
189232

190233
.. code-block:: none
191234

@@ -198,15 +241,13 @@ Connect to MongoDB
198241
...
199242
}
200243

201-
If you encounter an error or see no output, check whether you specified the
202-
proper connection string in the ``index.js`` file, and that you loaded the
244+
If you encounter an error or see no output, verify that you specified the
245+
proper connection string in the ``index.js`` file and that you loaded the
203246
sample data.
204247

205248
After you complete these steps, you have a working application that
206-
uses the driver to connect to your MongoDB deployment, runs a query on
207-
the sample data, and prints out the result.
208-
209-
.. include:: /includes/quick-start/troubleshoot.rst
249+
uses the driver to connect to your MongoDB deployment, run a query on
250+
the sample data, and print out the result.
210251

211252
.. _node-quick-start-next-steps:
212253
.. _node-get-started-next-steps:
@@ -216,11 +257,13 @@ Next Steps
216257

217258
Congratulations on completing the quick start tutorial!
218259

260+
.. include:: /includes/quick-start/troubleshoot.rst
261+
219262
In this tutorial, you created a Node.js application that
220263
connects to a MongoDB deployment hosted on MongoDB Atlas
221264
and retrieves a document that matches a query.
222265

223-
Learn more about the {+driver-long+} from the following resources:
266+
Learn more about the {+driver-short+} from the following resources:
224267

225268
- Discover how to perform read and write operations in the
226269
:ref:`CRUD Operations <node-crud-landing>` section.
Loading
Loading
Binary file not shown.

0 commit comments

Comments
 (0)