Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions source/fundamentals/atlas-search.txt
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,28 @@ The search returns the following document:
To learn more about the ``geoWithin`` operator, see the :atlas:`geoWithin </atlas-search/geoWithin>`
Atlas guide.

In
~~

Use the ``In()`` method to search for documents with field values that match a list
of specified values.

The following example searches the ``guitars`` collection for documents that have a
``make`` field value of either ``"Fender"`` or ``"Gibson"``.

.. literalinclude:: /includes/fundamentals/code-examples/atlas-search/AtlasSearchExamples.cs
:start-after: start-in-search
:end-before: end-in-search
:language: csharp
:dedent:

The search returns the following documents:

.. code-block:: json

{ "_id": 1, "make": "Fender", "description": "...", "establishedYear": 1946, "in_stock": true, "rating": 9 }
{ "_id": 2, "make": "Gibson", "description": "...", "establishedYear": 1902, "in_stock": true, "rating": 8 }

MoreLikeThis
~~~~~~~~~~~~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ public static List<Guitar> GeoWithinSearch()
return result;
}

public static List<Guitar> InSearch()
{
// start-in-search
var result = guitarsCollection.Aggregate()
.Search(Builders<Guitar>.Search.In(g => g.Make, ["Fender", "Gibson"]))
.ToList();
// end-in-search
return result;
}

public static List<Guitar> MoreLikeThisSearch()
{
// start-morelikethis-search
Expand Down
Loading