score:3
Accepted answer
there's no special support for that.
you need to explicitly add a filter for the discriminator field, _t
.
var results = await collection.find(builders<subclassb>.filter.eq("_t", nameof(subclassb))).tolistasync();
Source: stackoverflow.com
Related Query
- Using C# MongoDB v2 driver with discriminator and polymorphism
- MongoDb C# Driver with Group and Project using Aggregate() query giving exception
- Using C# MongoDB LINQ with discriminator
- Does MongoDb C# driver works with LINQ and dynamic documents?
- Grouping and projection with mongodb C# driver
- Query with filter builder on nested array using MongoDB C# driver with a given array of string
- MongoDB using a C# driver and time interval LINQ
- What does this C# code with an "arrow" mean and how is it called?
- How do I use the AsQueryable method asynchronously with MongoDb C# Driver 2.1?
- Using Distinct with LINQ and Objects
- How to update an element with a List using LINQ and C#
- Get and Add/Update multilevel embedded/nested MongoDB document using C#
- Lost decimal precision and scale using LINQ and stored procedure with output parameters
- How to query if array is null or empty using MongoDB and C# Driver?
- Select entities with multiple and nested levels without using Include
- Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool>
- Using LINQ Dynamic Query Library with Dictionary<string, object> and .AsQueryable()
- Duplicate rows when using orderby, Skip() and Take() with LINQ
- SELECT NEW with a potentially null field using LINQ and Entity Framework
- Dynamic Linq Predicate throws "Unsupported Filter" error with C# MongoDB Driver
- Sub-Query or Join with embedded/nested document using C# LINQ with MongoDB
- C# Predicate builder with using AND with OR
- Using LINQ left join with multiple conditions and subquery
- I want to get pairs of first and second letters of strings with the same length (by using LINQ)
- Using Linq and C#, is it possible to join two lists but with interleaving at each item?
- How to use MongoDB C# Driver Aggregate to get the latest item with specific values on 2 fields?
- How can I code an outer join using LINQ and EF6?
- Getting total result count and allowing pagination in the same query with MongoDB
- How to query many-to-many relationship with 'AND' condition using LINQ and Entity Framework
- What are the prerequisites for using SQL and LINQ with my winforms application in C#?
More Query from same tag
- How to call a function from Linq statement without a return value?
- fancy way to load contents of a CSV file into a dictionary<string,string> in C#
- How to get ranged by index with LINQ allow to take previous or next items?
- What is the big deal with IQueryable?
- How to combine the results of two DTOs in C# into one list of one type
- How to do a All() using Dynamic LINQ
- query with group by
- Find all pairs of intersecting rectangles with linq
- Distinct on a specific field
- lambda linq not join c#
- unable to create a constant value of type 'yyy'. only primitive types or enumeration types are supported in this context
- Does Enumerable.OrderBy order complete list if only first element is requested
- Looking for a generic way to handle Linq reports & return results in XML
- LINQ: why does this query not work on an ArrayList?
- LINQ search list of type Node with WHERE
- Making a function to be called within Linq functions
- Create a LINQ query
- LINQ, "Argument types do not match" error, what does it mean, how do I address it?
- C# - LINQ - Using column data in the WHERE clause of another LINQ query
- SubmitChanges call not updating data
- Using a variable ColumnName
- Unified SQL getter with LINQ
- Fetching timezone based on user logged in with httpcontext asp.net mvc
- Linq query change from List<string> to List<T> where clause
- How To Use Yield Inside A Linq Query
- Linq Results into IEnumerable in ViewModel in ASP.NET MVC Controller
- How to connect 2 Lists into 1 Model
- How to intersect two different object collections by specific property?
- LINQ GroupBy - Select lowest ID group by name
- Linq-to-sql One-To-Many with a max