File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -75,4 +75,23 @@ The following example creates indexes on the ``movies`` collection by using
7575
7676To learn more about creating indexes by using the driver, see the
7777`Indexes guide <{+driver-docs-root+}/fundamentals/indexes/>`__ in the
78- {+csharp-driver-long+} documentation.
78+ {+csharp-driver-long+} documentation.
79+
80+ Can I Access {+csharp-driver-short+} Features in the {+provider-short+}?
81+ ------------------------------------------------------------------------
82+
83+ You can use the {+csharp-driver-short+} directly in your {+provider-short+}
84+ application by calling driver methods on the ``MongoClient`` used to set up
85+ your ``DbContext``. The {+provider-short+} is built on top of the
86+ {+csharp-driver-short+}, so you can use all driver features in your
87+ application. For example, you can use the driver to perform an Atlas Search
88+ query as shown in the following example:
89+
90+ .. literalinclude:: /includes/code-examples/faq.cs
91+ :language: csharp
92+ :start-after: start-atlas-search
93+ :end-before: end-atlas-search
94+
95+ To learn more about performing Atlas Search queries with the
96+ {+csharp-driver-short+}, see the `Atlas Search guide <{+driver-docs-root+}/fundamentals/atlas-search/>`__ in the
97+ driver documentation.
Original file line number Diff line number Diff line change @@ -13,4 +13,21 @@ async Task CreateIndexesAsync(IMongoDatabase database)
1313 await database . GetCollection < Movie > ( "movies" )
1414 . Indexes . CreateOneAsync ( moviesIndex ) ;
1515}
16- // end-create-index
16+ // end-create-index
17+
18+ // start-atlas-search
19+ // Client used to set up your DbContext
20+ var client = new MongoClient ( "<connection string>" ) ;
21+
22+ var clientDB = client . GetDatabase ( "sample_guides" ) ;
23+ var collection = clientDB . GetCollection < Planet > ( "planets" ) ;
24+
25+ var searchResult = collection . Aggregate ( )
26+ . Search ( Builders < Planet > . Search . Equals ( p => p . hasRings , true ) )
27+ . ToList ( ) ;
28+
29+ foreach ( var p in searchResult )
30+ {
31+ Console . WriteLine ( p . name ) ;
32+ }
33+ // end-atlas-search
You can’t perform that action at this time.
0 commit comments