Skip to content

Commit a30cd25

Browse files
authored
DOCSP-29462: EMBED csharp labs (#142)
* DOCSP-29462: embed csharp labs * edit compat on index * CC suggestions * CC suggestions
1 parent 139fe47 commit a30cd25

File tree

4 files changed

+103
-32
lines changed

4 files changed

+103
-32
lines changed

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

Lines changed: 26 additions & 4 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
@@ -15,8 +13,16 @@ Retrieve Data
1513
Overview
1614
--------
1715

18-
In this guide, you can learn how to retrieve data from your MongoDB
19-
collections with the {+driver-long+}.
16+
In this guide, you can learn how to use the {+driver-long+} to retrieve
17+
data from a MongoDB collection by using read operations. You can call the
18+
``Find()`` method to retrieve documents that match a set of criteria.
19+
20+
.. tip:: Interactive Lab
21+
22+
You can complete a short interactive lesson that demonstrates how to
23+
retrieve data by using the ``Find()`` method in an in-browser coding
24+
experience. To learn more, see the :ref:`csharp-retrieve-instruqt-lab`
25+
section of this guide.
2026

2127
Sample Data
2228
~~~~~~~~~~~
@@ -247,6 +253,22 @@ The following example performs these actions:
247253
`Dispose() <https://learn.microsoft.com/en-us/dotnet/api/system.idisposable.dispose?view=net-7.0>`__
248254
method once the cursor is no longer in use.
249255

256+
.. _csharp-retrieve-instruqt-lab:
257+
258+
Complete an Interactive Lesson
259+
------------------------------
260+
261+
This lab helps you understand how to use the {+driver-short+} to perform
262+
read operations in MongoDB by using the ``Find()`` method. You can
263+
complete this lab directly in your browser window without installing
264+
MongoDB or a code editor.
265+
266+
.. tip::
267+
268+
To expand the lab to a full-screen format, click the full-screen
269+
button, :guilabel:`⛶`, in the bottom right corner of the lab pane.
270+
271+
.. instruqt:: /mongodb-docs/tracks/find-csharp?token=em_R1T7ZloiDGciGxye
250272

251273
.. _csharp-retrieve-additional-information:
252274

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

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
Insert Documents
55
================
66

7-
.. default-domain:: mongodb
8-
97
.. contents:: On this page
108
:local:
119
:backlinks: none
@@ -15,8 +13,22 @@ Insert Documents
1513
Overview
1614
--------
1715

18-
In this guide, you can learn how to add documents to your MongoDB
19-
collections using insert operations.
16+
In this guide, you can learn how to use the {+driver-long+} to add
17+
documents to a MongoDB collection by performing insert operations.
18+
19+
An insert operation inserts one or more documents into a MongoDB collection.
20+
The {+driver-short+} provides the following methods to perform insert
21+
operations, each of which has an asynchronous and synchronous version:
22+
23+
- ``InsertOneAsync()`` or ``InsertOne()``
24+
- ``InsertManyAsync()`` or ``InsertMany()``
25+
26+
.. tip:: Interactive Lab
27+
28+
You can complete a short interactive lesson that demonstrates how to
29+
insert data by using the ``InsertOneAsync()`` method in an in-browser coding
30+
experience. To learn more, see the :ref:`csharp-insert-instruqt-lab`
31+
section of this guide.
2032

2133
Sample Data
2234
~~~~~~~~~~~
@@ -78,18 +90,8 @@ To learn more about the ``_id`` field, see the Server Manual Entry on
7890
To learn more about document structure and rules, see the
7991
Server Manual Entry on :manual:`Documents </core/document>`.
8092

81-
Insert Operations
82-
-----------------
83-
84-
Use insert operations to add documents to a collection. You can perform
85-
inserts in MongoDB with the following methods:
86-
87-
- ``InsertOne()``, which inserts a single document
88-
- ``InsertMany()``, which inserts multiple documents stored in an
89-
``IEnumerable`` interface
90-
9193
Insert One Document
92-
~~~~~~~~~~~~~~~~~~~
94+
-------------------
9395

9496
The following code shows how to use the asynchronous
9597
``InsertOneAsync()`` method or the synchronous ``InsertOne()`` method to
@@ -114,7 +116,7 @@ insert one document.
114116
_restaurantsCollection.InsertOne(document);
115117

116118
Insert Multiple Documents
117-
~~~~~~~~~~~~~~~~~~~~~~~~~
119+
-------------------------
118120

119121
The following code shows how to use the asynchronous
120122
``InsertManyAsync()`` method or the synchronous ``InsertMany()`` method to
@@ -143,8 +145,8 @@ insert multiple documents.
143145
Find runnable examples using these methods under :ref:`additional
144146
information <additional-info>`.
145147

146-
Parameters
147-
~~~~~~~~~~
148+
Modify Insert Behavior
149+
----------------------
148150

149151
The ``InsertOne()`` method takes the document you seek to insert as a
150152
parameter. The ``InsertMany()`` method takes an ``IEnumerable``
@@ -216,8 +218,8 @@ see :ref:`csharp-find-one`.
216218

217219
.. _csharp-ordered-behavior:
218220

219-
Ordered Behavior
220-
~~~~~~~~~~~~~~~~
221+
Specify Ordered Behavior
222+
------------------------
221223

222224
Assume you want to insert the following documents:
223225

@@ -256,6 +258,22 @@ If you look inside your collection, you should be able to see the following docu
256258
{ "_id" : 2, "name" : "Restaurant B" }
257259
{ "_id" : 3, "name" : "Restaurant D" }
258260

261+
.. _csharp-insert-instruqt-lab:
262+
263+
Complete an Interactive Lesson
264+
------------------------------
265+
266+
This lab helps you understand how to use the {+driver-short+} to perform insert operations in MongoDB
267+
by using the ``InsertOneAsync()`` method. You can complete this lab directly in
268+
your browser window without installing MongoDB or a code editor.
269+
270+
.. tip::
271+
272+
To expand the lab to a full-screen format, click the full-screen
273+
button, :guilabel:`⛶`, in the bottom right corner of the lab pane.
274+
275+
.. instruqt:: /mongodb-docs/tracks/insert-a-document---c-net-driver?token=em__BF-Ccd2b1dS3YLi
276+
259277
.. _additional-info:
260278

261279
Additional Information

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

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

16-
In this guide, you can learn how to modify documents in a MongoDB
17-
collection using two different kinds of operations:
16+
In this guide, you can learn how to use the {+driver-long+} to modify
17+
documents in a MongoDB collection by performing the following operations:
1818

19-
- :ref:`Update <csharp-update-operation>`
20-
- :ref:`Replace <csharp-replace-operation>`
19+
- :ref:`Update Operations <csharp-update-operation>`
20+
- :ref:`Replace Operations <csharp-replace-operation>`
21+
22+
The {+driver-short+} provides the following methods to modify documents,
23+
each of which has an asynchronous and synchronous version:
24+
25+
- ``UpdateOneAsync()`` or ``UpdateOne()``
26+
- ``UpdateManyAsync()`` or ``UpdateMany()``
27+
- ``ReplaceOneAsync()`` or ``ReplaceOne()``
28+
29+
.. tip:: Interactive Lab
30+
31+
You can complete a short interactive lesson that demonstrates how to
32+
modify data by using the ``UpdateManyAsync()`` method in an in-browser coding
33+
experience. To learn more, see the :ref:`csharp-update-instruqt-lab`
34+
section of this guide.
2135

2236
Sample Data
2337
~~~~~~~~~~~
@@ -474,6 +488,23 @@ match any existing documents.
474488
Replaced documents: 1
475489
Result acknowledged? True
476490

491+
.. _csharp-update-instruqt-lab:
492+
493+
Complete an Interactive Lesson
494+
------------------------------
495+
496+
This lab helps you understand how to use the {+driver-short+} to perform
497+
update operations in MongoDB by using the ``UpdateManyAsync()`` method.
498+
You can complete this lab directly in your browser window without
499+
installing MongoDB or a code editor.
500+
501+
.. tip::
502+
503+
To expand the lab to a full-screen format, click the full-screen
504+
button, :guilabel:`⛶`, in the bottom right corner of the lab pane.
505+
506+
.. instruqt:: /mongodb-docs/tracks/update-a-document---c-net-driver?token=em_69t_l-j0BC_en7Uy
507+
477508
.. _csharp-change-info:
478509

479510
Additional Information

source/index.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ Previous Versions
3939

4040
For documentation on versions of the driver v2.18 and earlier, see the :ref:`csharp-previous-versions` section.
4141

42-
Compatibility
43-
-------------
42+
Connect to a Compatible MongoDB Deployment
43+
------------------------------------------
4444

45-
You can use the {+driver-short+} to connect to deployments hosted in the
46-
following environments:
45+
You can use the {+driver-short+} to connect to MongoDB
46+
deployments running on one of the following hosted services or editions:
4747

4848
.. include:: /includes/fact-environments.rst
4949

0 commit comments

Comments
 (0)