From 5f41ab0298cf1ced23eaa7ce1c84d459e9120a9c Mon Sep 17 00:00:00 2001 From: Jordan Smith Date: Thu, 7 Nov 2024 06:16:17 -0800 Subject: [PATCH 1/3] add example for elemmatch --- source/fundamentals/builders.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/fundamentals/builders.txt b/source/fundamentals/builders.txt index 88adf7a9..958b7459 100644 --- a/source/fundamentals/builders.txt +++ b/source/fundamentals/builders.txt @@ -105,7 +105,16 @@ Use builders to check which documents in the collection have a var builder = Builders.Filter; var filter = builder.AnyEq(f => f.Season, "winter"); -.. TODO for a complete list of expressions, see the Query page? +You can also use the ``ElemMatch()`` method to find documents that contain an +array field that contains at least one element that matches your search criteria. The +following example returns documents that contain the value ``"Summer"`` in +their ``Season`` array: + +.. code-block:: csharp + :copyable: true + + var builder = Builders.Filter; + var filter = builder.ElemMatch(f => f.Season, s => s == "Summer"); .. _csharp-builders-projection: From 7fb5768c8080c32c9e3fa7a9a03230bef3858cb0 Mon Sep 17 00:00:00 2001 From: Jordan Smith Date: Thu, 7 Nov 2024 06:21:30 -0800 Subject: [PATCH 2/3] add link to manual --- source/fundamentals/builders.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/fundamentals/builders.txt b/source/fundamentals/builders.txt index 958b7459..bd954e8f 100644 --- a/source/fundamentals/builders.txt +++ b/source/fundamentals/builders.txt @@ -116,6 +116,9 @@ their ``Season`` array: var builder = Builders.Filter; var filter = builder.ElemMatch(f => f.Season, s => s == "Summer"); +To learn more about array operators, see the :manual:`Array Query Operators +` guide in the {+mdb-server+} manual. + .. _csharp-builders-projection: Create a Projection From 373d9dc4a61bd0b355ac86d03555fceeb758df23 Mon Sep 17 00:00:00 2001 From: Jordan Smith Date: Thu, 7 Nov 2024 06:39:20 -0800 Subject: [PATCH 3/3] edit --- source/fundamentals/builders.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/fundamentals/builders.txt b/source/fundamentals/builders.txt index bd954e8f..a3309e66 100644 --- a/source/fundamentals/builders.txt +++ b/source/fundamentals/builders.txt @@ -105,10 +105,10 @@ Use builders to check which documents in the collection have a var builder = Builders.Filter; var filter = builder.AnyEq(f => f.Season, "winter"); -You can also use the ``ElemMatch()`` method to find documents that contain an -array field that contains at least one element that matches your search criteria. The -following example returns documents that contain the value ``"Summer"`` in -their ``Season`` array: +You can also call the ``ElemMatch()`` method to find documents that have an +array field that contains at least one element that matches a specified search +criteria. The following example returns documents that contain the value +``"Summer"`` in their ``Season`` array: .. code-block:: csharp :copyable: true