Skip to content

Commit bda8067

Browse files
DOCSP-39979 Add example for ElemMatch builder (#288)
(cherry picked from commit 051e6ca)
1 parent 083e7e9 commit bda8067

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

source/fundamentals/builders.txt

+13-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,19 @@ Use builders to check which documents in the collection have a
105105
var builder = Builders<Flower>.Filter;
106106
var filter = builder.AnyEq(f => f.Season, "winter");
107107

108-
.. TODO for a complete list of expressions, see the Query page?
108+
You can also call the ``ElemMatch()`` method to find documents that have an
109+
array field that contains at least one element that matches a specified search
110+
criteria. The following example returns documents that contain the value
111+
``"Summer"`` in their ``Season`` array:
112+
113+
.. code-block:: csharp
114+
:copyable: true
115+
116+
var builder = Builders<Flower>.Filter;
117+
var filter = builder.ElemMatch(f => f.Season, s => s == "Summer");
118+
119+
To learn more about array operators, see the :manual:`Array Query Operators
120+
</reference/operator/query-array/>` guide in the {+mdb-server+} manual.
109121

110122
.. _csharp-builders-projection:
111123

0 commit comments

Comments
 (0)