@@ -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+
102104Array Operators
103105~~~~~~~~~~~~~~~
104106
@@ -126,6 +128,24 @@ criteria. The following example returns documents that contain the value
126128 var builder = Builders<Flower>.Filter;
127129 var filter = builder.ElemMatch(f => f.Season, s => s == "Summer");
128130
131+ .. tip:: ElemMatch() Overload
132+
133+ The ``ElemMatch()`` method has an overload to accept a single filter
134+ parameter. This functionality supports performing queries that
135+ include nested ``$elemMatch`` statements.
136+
137+ The following code demonstrates how to construct a nested
138+ ``$elemMatch`` query that uses both implementations of the
139+ ``ElemMatch()`` method:
140+
141+ .. code-block:: csharp
142+
143+ // ElemMatch() with only filter parameter
144+ var arrayFilter = Builders<MyEntry[]>.Filter.ElemMatch(<filter>);
145+
146+ // ElemMatch() with field name and filter parameters
147+ var filter = Builders<MyClass>.Filter.ElemMatch(<array field name>, arrayFilter);
148+
129149To learn more about array operators, see the :manual:`Array Query Operators
130150</reference/operator/query-array/>` guide in the {+mdb-server+} manual.
131151
@@ -491,4 +511,5 @@ guide, see the following API Documentation:
491511- `SortDefinitionBuilder <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.SortDefinitionBuilder-1.html>`__
492512- `UpdateDefinitionBuilder <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.UpdateDefinitionBuilder-1.html>`__
493513- `IndexKeysDefinitionBuilder <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.IndexKeysDefinitionBuilder-1.html>`__
494- - `PipelineDefinitionBuilder <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.PipelineDefinitionBuilder.html>`__
514+ - `PipelineDefinitionBuilder
515+ <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.PipelineDefinitionBuilder.html>`__
0 commit comments