Skip to content

Commit 928a1f1

Browse files
authored
DOCSP-29461: node lab embedding (#820)
* DOCSP-29461: Node lab embed (instruqt) * add all labs * NR PR fixes 1 * small fixes * template * template * rm template
1 parent 136213f commit 928a1f1

File tree

3 files changed

+77
-24
lines changed

3 files changed

+77
-24
lines changed

source/fundamentals/crud/read-operations/retrieve.txt

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
Retrieve Data
55
=============
66

7-
.. default-domain:: mongodb
8-
97
.. contents:: On this page
108
:local:
119
:backlinks: none
@@ -17,14 +15,19 @@ Retrieve Data
1715
Overview
1816
--------
1917

20-
You can use read operations to retrieve data from your MongoDB database.
21-
There are multiple types of read operations that access the data in
22-
different ways. If you want to request results based on a set of criteria
23-
from the existing set of data, you can use a find operation such as the
24-
``find()`` or ``findOne()`` methods.
18+
You can perform find operations to retrieve data from your MongoDB database.
19+
You can perform a find operation to match documents on a set of criteria
20+
by calling the ``find()`` or ``findOne()`` method.
21+
22+
.. tip:: Interactive Lab
23+
24+
You can complete an interactive lab that uses the
25+
``find()`` method to retrieve data in the
26+
:ref:`node-retrieve-instruqt-lab` section of this guide.
2527

26-
You can also further specify the information you are requesting by
27-
including additional parameters or by chaining other methods such as:
28+
You can also further specify the information that the find operation
29+
returns by specifying optional parameters or by chaining other methods,
30+
as shown in the following guides:
2831

2932
- :ref:`node-fundamentals-sort`
3033
- :ref:`node-fundamentals-skip`
@@ -41,9 +44,6 @@ matching data is inserted.
4144

4245
.. include:: /includes/access-cursor-note.rst
4346

44-
Compatibility
45-
-------------
46-
4747
.. |page-topic| replace:: perform read operations
4848
.. |link-topic-ing| replace:: performing read operations in the Atlas UI
4949

@@ -199,6 +199,16 @@ data whenever write operations are executed on the collection.
199199
:start-after: start watch crud example
200200
:end-before: end watch crud example
201201

202-
203202
For a runnable example of the ``watch()`` method using the NodeJS driver, see
204203
the :ref:`change streams <node-usage-watch>` usage example.
204+
205+
.. _node-retrieve-instruqt-lab:
206+
207+
Interactive Find Operation Lab
208+
------------------------------
209+
210+
This lab helps you understand how to perform read operations in MongoDB
211+
by using the ``find()`` method. You can complete this lab without
212+
installing MongoDB or a code editor.
213+
214+
.. instruqt:: /mongodb-docs/tracks/find-node?token=em_OVNHWCPNPMLwNOCm

source/fundamentals/crud/write-operations/insert.txt

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
.. _node-fundamentals-insert-data:
22

3-
=================
4-
Insert a Document
5-
=================
6-
7-
.. default-domain:: mongodb
3+
================
4+
Insert Documents
5+
================
86

97
.. contents:: On this page
108
:local:
@@ -22,8 +20,19 @@ perform any of those operations, that information, such as user profiles
2220
and orders, needs to exist in MongoDB. For that information to exist,
2321
you need to first perform an **insert operation**.
2422

25-
An insert operation inserts a single or multiple documents in MongoDB
26-
using the ``insertOne()``, ``insertMany()`` and ``bulkWrite()`` methods.
23+
An insert operation inserts one or more documents into a MongoDB collection.
24+
The {+driver-short+} provides the following methods to perform insert
25+
operations:
26+
27+
- ``insertOne()``
28+
- ``insertMany()``
29+
- ``bulkWrite()``
30+
31+
.. tip:: Interactive Lab
32+
33+
You can complete an interactive lab that uses the
34+
``insertOne()`` method to insert data in the
35+
:ref:`node-insert-instruqt-lab` section of this guide.
2736

2837
The following sections focus on ``insertOne()`` and ``insertMany()``. For an
2938
example on how to use the ``bulkWrite()`` method, see our runnable :doc:`Bulk
@@ -221,3 +230,14 @@ section, see the following resources:
221230
- API Documentation on `PkFactory <{+api+}/interfaces/PkFactory.html>`__
222231
- Server Manual Entry on :manual:`insertMany() </reference/method/db.collection.insertMany/>`
223232
- Runnable :doc:`Insert Multiple Documents Example </usage-examples/insertMany>`
233+
234+
.. _node-insert-instruqt-lab:
235+
236+
Interactive Insert Operation Lab
237+
--------------------------------
238+
239+
This lab helps you understand how to perform insert operations in MongoDB
240+
by using the ``insertOne()`` method. You can complete this lab without
241+
installing MongoDB or a code editor.
242+
243+
.. instruqt:: /mongodb-docs/tracks/insert-node?token=em_S6rjcmIzxGB4Sz_y

source/fundamentals/crud/write-operations/modify.txt

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,23 @@ Modify Documents
1313
Overview
1414
--------
1515

16-
You can modify documents in a MongoDB collection using either **update**
17-
or **replace** operations. Update operations mutate
16+
You can modify documents in a MongoDB collection using **update**
17+
and **replace** operations. Update operations change
1818
specified fields in one or more documents and leave other fields and values
19-
unchanged. Replace operations remove all existing fields in one or more
20-
documents and substitute them with specified fields and values.
19+
unchanged. Replace operations remove all fields except the ``_id`` field
20+
in an existing document and substitute them with specified fields and values.
21+
22+
The {+driver-short+} provides the following methods to change documents:
23+
24+
- ``updateOne()``
25+
- ``updateMany()``
26+
- ``replaceOne()``
27+
28+
.. tip:: Interactive Lab
29+
30+
You can complete an interactive lab that uses the
31+
``updateMany()`` method to modify data in the
32+
:ref:`node-update-instruqt-lab` section of this guide.
2133

2234
.. _updateDocuments:
2335

@@ -203,3 +215,14 @@ inserts a new document with the specified fields and values.
203215
You cannot modify the ``_id`` field of a document nor change a field to
204216
a value that violates a unique index constraint. See the MongoDB Server manual
205217
for more information on :manual:`unique indexes </core/index-unique/>`.
218+
219+
.. _node-update-instruqt-lab:
220+
221+
Interactive Update Operation Lab
222+
--------------------------------
223+
224+
This lab helps you understand how to perform update operations in MongoDB
225+
by using the ``updateMany()`` method. You can complete this lab without
226+
installing MongoDB or a code editor.
227+
228+
.. instruqt:: /mongodb-docs/tracks/update-node?token=em_FEr9KfMh4WQ0VosU

0 commit comments

Comments
 (0)