@@ -128,6 +128,25 @@ criteria. The following example returns documents that contain the value
128
128
var builder = Builders<Flower>.Filter;
129
129
var filter = builder.ElemMatch(f => f.Season, s => s == "Summer");
130
130
131
+ .. tip:: ElemMatch() Overload
132
+
133
+ The ``ElemMatch()`` method has an overload that accepts a single *filter*
134
+ parameter. You can use this overload to perform ``$elemMatch``
135
+ queries directly against values. This functionality can support
136
+ queries that include nested ``$elemMatch`` statements.
137
+
138
+ The following code demonstrates how to construct a nested
139
+ ``$elemMatch`` query that uses multiple overloads of the
140
+ ``ElemMatch()`` method:
141
+
142
+ .. code-block:: csharp
143
+
144
+ // ElemMatch() with only filter parameter
145
+ var arrayFilter = Builders<MyEntry[]>.Filter.ElemMatch(<filter>);
146
+
147
+ // ElemMatch() with field name and filter parameters
148
+ var filter = Builders<MyClass>.Filter.ElemMatch(<array field name>, arrayFilter);
149
+
131
150
To learn more about array operators, see the :manual:`Array Query Operators
132
151
</reference/operator/query-array/>` guide in the {+mdb-server+} manual.
133
152
@@ -493,4 +512,5 @@ guide, see the following API Documentation:
493
512
- `SortDefinitionBuilder <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.SortDefinitionBuilder-1.html>`__
494
513
- `UpdateDefinitionBuilder <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.UpdateDefinitionBuilder-1.html>`__
495
514
- `IndexKeysDefinitionBuilder <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.IndexKeysDefinitionBuilder-1.html>`__
496
- - `PipelineDefinitionBuilder <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.PipelineDefinitionBuilder.html>`__
515
+ - `PipelineDefinitionBuilder
516
+ <{+new-api-root+}/MongoDB.Driver/MongoDB.Driver.PipelineDefinitionBuilder.html>`__
0 commit comments