Skip to content

Commit 6ae65f7

Browse files
committed
DOCSP-42611: Filter Inject() example (#375)
(cherry picked from commit 5de532a)
1 parent 9459558 commit 6ae65f7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

source/fundamentals/builders.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ Alternatively, you can use string-based field names to contruct the filter:
8484
var builder = Builders<Flower>.Filter;
8585
var filter = builder.Lt("Price", 20) & builder.Eq("Category", "Perennial");
8686

87+
If you are using LINQ, you can also use the ``Inject()`` method to apply the filter
88+
to a LINQ query:
89+
90+
.. code-block:: csharp
91+
:copyable: true
92+
93+
var builder = Builders<Flower>.Filter;
94+
var filter = builder.Lt("Price", 20) & builder.Eq("Category", "Perennial");
95+
var query = collection.AsQueryable().Where(f => filter.Inject());
96+
8797
Array Operators
8898
~~~~~~~~~~~~~~~
8999

0 commit comments

Comments
 (0)