Skip to content

Commit 970d0bd

Browse files
authored
Merge branch 'master' into DOCSP-48356-skipwhile-takewhile
2 parents 6b4dfbe + bd02e59 commit 970d0bd

26 files changed

+616
-518
lines changed

config/redirects

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
define: prefix docs/drivers/csharp
22
define: base https://www.mongodb.com/${prefix}
3-
define: versions v2.19 v2.20 v2.21 v2.22 v2.23 v2.24 v2.25 v2.26 v2.27 v2.28 v2.29 v2.30 v3.0 v3.1 master
3+
define: versions v2.19 v2.20 v2.21 v2.22 v2.23 v2.24 v2.25 v2.26 v2.27 v2.28 v2.29 v2.30 v3.0 v3.1 v3.2 v3.3 master
44

55
symlink: current -> master
66

snooty.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ mdb-server = "MongoDB Server"
3434
mongo-community = "MongoDB Community Edition"
3535
mongo-enterprise = "MongoDB Enterprise Edition"
3636
docs-branch = "master" # always set this to the docs branch (i.e. master, 1.7, 1.8, etc.)
37-
version-number = "3.2"
37+
version-number = "3.3"
3838
last-version-2-number = "2.30"
3939
version = "v{+version-number+}"
4040
example = "https://raw.githubusercontent.com/mongodb/docs-csharp/{+docs-branch+}/source/includes/code-examples"

source/fundamentals/atlas-search.txt

Lines changed: 118 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,11 @@ The examples in this guide use the following documents in a collection called
4848

4949
The following ``Guitar`` class models the documents in this collection.
5050

51-
.. code-block:: csharp
52-
53-
public class Guitar
54-
{
55-
public int Id { get; set; }
56-
public string Make { get; set; }
57-
public List<string> Models { get; set; }
58-
public int EstablishedYear { get; set; }
59-
[BsonElement("in_stock")]
60-
public bool InStock { get; set; }
61-
public int? Rating { get; set; }
62-
}
51+
.. literalinclude:: /includes/fundamentals/code-examples/atlas-search/AtlasSearchExamples.cs
52+
:start-after: // start-guitar-class
53+
:end-before: // end-guitar-class
54+
:language: csharp
55+
:dedent:
6356

6457
.. note::
6558

@@ -709,3 +702,116 @@ The search returns the following document:
709702

710703
To learn more about the ``wildcard`` operator, see the :atlas:`wildcard </atlas-search/wildcard>`
711704
Atlas guide.
705+
706+
Modify Atlas Search Behavior
707+
----------------------------
708+
709+
You can modify the behavior of the ``Search()`` method by passing
710+
a ``SearchOptions`` object as a parameter.
711+
712+
The ``SearchOptions`` class contains the following properties:
713+
714+
.. list-table::
715+
:widths: 30 70
716+
:header-rows: 1
717+
718+
* - Property
719+
- Description
720+
721+
* - ``CountOptions``
722+
- | The options for counting the search results.
723+
724+
| **Data type**: `SearchCountOptions <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.Search.SearchCountOptions.html>`__
725+
| **Default**: ``null``
726+
727+
* - ``Highlight``
728+
- | The options for displaying search terms in their original context.
729+
730+
| **Data type**: `SearchHighlightOptions<TDocument> <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.Search.SearchHighlightOptions-1.html>`__
731+
| **Default**: ``null``
732+
733+
* - ``IndexName``
734+
- | The index to use for the search.
735+
736+
| **Data type**: {+string-data-type+}
737+
| **Default**: ``null``
738+
739+
* - ``ReturnStoredSource``
740+
- | A flag that specifies whether to perform a full document lookup on
741+
the database or to return only stored source fields directly from
742+
Atlas Search.
743+
744+
| **Data type**: {+bool-data-type+}
745+
| **Default**: ``false``
746+
747+
* - ``ScoreDetails``
748+
- | A flag that specifies whether to return detailed information about the
749+
score for each document in the results.
750+
751+
| **Data type**: {+bool-data-type+}
752+
| **Default**: ``false``
753+
754+
* - ``SearchAfter``
755+
- | The starting point for pagination. When set, the search retrieves documents
756+
starting immediately after the specified reference point.
757+
758+
| **Data type**: {+string-data-type+}
759+
| **Default**: ``null``
760+
761+
* - ``SearchBefore``
762+
- | The end point for pagination. When set, the search retrieves documents
763+
starting immediately before the specified reference point.
764+
765+
| **Data type**: {+string-data-type+}
766+
| **Default**: ``null``
767+
768+
* - ``Sort``
769+
- | The sorting criteria to apply to the results.
770+
771+
| **Data type**: `SortDefinition<TDocument> <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.SortDefinition-1.html>`__
772+
| **Default**: ``null``
773+
774+
* - ``Tracking``
775+
- | The options for tracking search terms.
776+
777+
| **Data type**: `SearchTrackingOptions <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.Search.SearchTrackingOptions.html>`__
778+
| **Default**: ``null``
779+
780+
SearchAfter Example
781+
~~~~~~~~~~~~~~~~~~~
782+
783+
The following example paginates the results of an Atlas Search
784+
operation by performing the following actions:
785+
786+
- Defines a projection that uses the ``MetaSearchSequenceToken()``
787+
builder method, which specifies a ``PaginationToken`` to contain
788+
the point of reference
789+
790+
- Creates a ``SearchOptions`` instance and sets the index and sort
791+
criteria to use
792+
793+
- Runs an initial search to find documents that have a ``description`` field value containing
794+
the text ``"classic"``, applying the projection and options to the operation
795+
796+
- Sets the ``SearchAfter`` property of the same ``SearchOptions`` instance to
797+
instruct the next search to begin after the base search's first result
798+
799+
- Runs another search operation that has the same matching criteria and applies
800+
the search options to paginate the results
801+
802+
.. literalinclude:: /includes/fundamentals/code-examples/atlas-search/AtlasSearchExamples.cs
803+
:start-after: // start-pagination-options
804+
:end-before: // end-pagination-options
805+
:language: csharp
806+
:dedent:
807+
808+
The search returns the following document:
809+
810+
.. code-block:: json
811+
812+
{ "_id": 2, "make": "Gibson", "description": "Classic guitars known for their rich, full tones.", "establishedYear": 1902, "in_stock": true, "rating": 8 }
813+
814+
.. tip::
815+
816+
To learn more about Atlas Search pagination, see :atlas:`Paginate the Results </atlas-search/paginate-results/>`
817+
in the Atlas documentation.

source/fundamentals/builders.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ to a LINQ query:
9999
var filter = builder.Lt("Price", 20) & builder.Eq("Category", "Perennial");
100100
var query = collection.AsQueryable().Where(f => filter.Inject());
101101

102+
.. _csharp-builders-array-operators:
103+
102104
Array Operators
103105
~~~~~~~~~~~~~~~
104106

source/fundamentals/connection/connect.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,7 @@ hosts, including ``sample.host1``:
154154
:language: csharp
155155
:start-after: // start replica set connection
156156
:end-before: // end replica set connection
157+
158+
.. note:: Replica Set in Docker
159+
160+
.. sharedinclude:: dbx/docker-replica-set.rst

source/fundamentals/crud/read-operations/change-streams.txt

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,11 @@ classes:
6565
- ``Collection``: To monitor changes in the collection
6666

6767
The following example opens a change stream on the ``restaurants`` collection
68-
and outputs the changes as they occur. Select the
69-
:guilabel:`Asynchronous` or :guilabel:`Synchronous` tab to see the corresponding
70-
code.
68+
and outputs the changes as they occur. Select the :guilabel:`Synchronous` or
69+
:guilabel:`Asynchronous` tab to see the corresponding code.
7170

7271
.. tabs::
7372

74-
.. tab:: Asynchronous
75-
:tabid: change-stream-async
76-
77-
.. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
78-
:start-after: start-open-change-stream-async
79-
:end-before: end-open-change-stream-async
80-
:language: csharp
81-
8273
.. tab:: Synchronous
8374
:tabid: change-stream-sync
8475

@@ -87,6 +78,14 @@ code.
8778
:end-before: end-open-change-stream
8879
:language: csharp
8980

81+
.. tab:: Asynchronous
82+
:tabid: change-stream-async
83+
84+
.. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
85+
:start-after: start-open-change-stream-async
86+
:end-before: end-open-change-stream-async
87+
:language: csharp
88+
9089
To begin watching for changes, run the application. Then, in a separate
9190
application or shell, modify the ``restaurants`` collection. Updating a document
9291
that has a ``"name"`` value of ``"Blarney Castle"`` results in the following
@@ -134,20 +133,12 @@ You can specify the following aggregation stages in the ``pipeline`` parameter:
134133
Monitor Update Events Example
135134
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
136135

137-
The following example uses the ``pipeline`` parameter to open a change stream
138-
that records only update operations. Select the :guilabel:`Asynchronous` or :guilabel:`Synchronous` tab to see the
139-
corresponding code.
136+
The following example uses the ``pipeline`` parameter to open a change stream that records
137+
only update operations. Select the :guilabel:`Synchronous` or :guilabel:`Asynchronous` tab
138+
to see the corresponding code.
140139

141140
.. tabs::
142141

143-
.. tab:: Asynchronous
144-
:tabid: change-stream-async
145-
146-
.. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
147-
:start-after: start-change-stream-pipeline-async
148-
:end-before: end-change-stream-pipeline-async
149-
:language: csharp
150-
151142
.. tab:: Synchronous
152143
:tabid: change-stream-sync
153144

@@ -156,6 +147,14 @@ corresponding code.
156147
:end-before: end-change-stream-pipeline
157148
:language: csharp
158149

150+
.. tab:: Asynchronous
151+
:tabid: change-stream-async
152+
153+
.. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
154+
:start-after: start-change-stream-pipeline-async
155+
:end-before: end-change-stream-pipeline-async
156+
:language: csharp
157+
159158
Split Large Change Events Example
160159
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
161160

@@ -173,14 +172,6 @@ reassemble any event fragments:
173172

174173
.. tabs::
175174

176-
.. tab:: Asynchronous
177-
:tabid: change-stream-split-async
178-
179-
.. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
180-
:start-after: start-split-change-event-async
181-
:end-before: end-split-change-event-async
182-
:language: csharp
183-
184175
.. tab:: Synchronous
185176
:tabid: change-stream-split-sync
186177

@@ -189,6 +180,14 @@ reassemble any event fragments:
189180
:end-before: end-split-change-event-sync
190181
:language: csharp
191182

183+
.. tab:: Asynchronous
184+
:tabid: change-stream-split-async
185+
186+
.. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
187+
:start-after: start-split-change-event-async
188+
:end-before: end-split-change-event-async
189+
:language: csharp
190+
192191
.. note::
193192

194193
We recommend reassembling change event fragments, as shown in the
@@ -202,6 +201,14 @@ The following code defines these methods:
202201

203202
.. tabs::
204203

204+
.. tab:: Synchronous
205+
:tabid: split-event-helpers-sync
206+
207+
.. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
208+
:start-after: start-split-event-helpers-sync
209+
:end-before: end-split-event-helpers-sync
210+
:language: csharp
211+
205212
.. tab:: Asynchronous
206213
:tabid: split-event-helpers-async
207214

@@ -210,14 +217,6 @@ The following code defines these methods:
210217
:end-before: end-split-event-helpers-async
211218
:language: csharp
212219

213-
.. tab:: Synchronous
214-
:tabid: split-event-helpers-sync
215-
216-
.. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
217-
:start-after: start-split-event-helpers-sync
218-
:end-before: end-split-event-helpers-sync
219-
:language: csharp
220-
221220
.. tip::
222221

223222
To learn more about splitting large change events, see
@@ -344,19 +343,11 @@ one of the following values:
344343

345344
The following example opens a change stream on a collection and includes the post-image
346345
of updated documents by specifying the ``FullDocument`` option. Select the
347-
:guilabel:`Asynchronous` or :guilabel:`Synchronous` tab to see the corresponding
346+
:guilabel:`Synchronous` or :guilabel:`Asynchronous` tab to see the corresponding
348347
code.
349348

350349
.. tabs::
351350

352-
.. tab:: Asynchronous
353-
:tabid: change-stream-async
354-
355-
.. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
356-
:start-after: start-change-stream-post-image-async
357-
:end-before: end-change-stream-post-image-async
358-
:language: csharp
359-
360351
.. tab:: Synchronous
361352
:tabid: change-stream-sync
362353

@@ -365,6 +356,14 @@ code.
365356
:end-before: end-change-stream-post-image
366357
:language: csharp
367358

359+
.. tab:: Asynchronous
360+
:tabid: change-stream-async
361+
362+
.. literalinclude:: /includes/code-examples/change-streams/change-streams.cs
363+
:start-after: start-change-stream-post-image-async
364+
:end-before: end-change-stream-post-image-async
365+
:language: csharp
366+
368367
Running the preceding code example and updating a document that has a ``"name"``
369368
value of ``"Blarney Castle"`` results in the following change stream output:
370369

0 commit comments

Comments
 (0)