Skip to content

Commit 5de532a

Browse files
authored
DOCSP-42611: Filter Inject() example (#375)
1 parent a2a9e5d commit 5de532a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: source/fundamentals/builders.txt

+10
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ Alternatively, you can use string-based field names to contruct the filter:
8989
var builder = Builders<Flower>.Filter;
9090
var filter = builder.Lt("Price", 20) & builder.Eq("Category", "Perennial");
9191

92+
If you are using LINQ, you can also use the ``Inject()`` method to apply the filter
93+
to a LINQ query:
94+
95+
.. code-block:: csharp
96+
:copyable: true
97+
98+
var builder = Builders<Flower>.Filter;
99+
var filter = builder.Lt("Price", 20) & builder.Eq("Category", "Perennial");
100+
var query = collection.AsQueryable().Where(f => filter.Inject());
101+
92102
Array Operators
93103
~~~~~~~~~~~~~~~
94104

0 commit comments

Comments
 (0)