[CSHARP-2110] Discriminator of the query of sub typed collections is incorrect Created: 23/Nov/17 Updated: 15/Nov/21 Resolved: 25/Jun/20 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | T Cools | Assignee: | Wan Bachtiar |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
I have following scenario: I'm using the the Mongo C# Driver with CosmosDB and I use a single collection to store different document types. I not really happy with this, but it seems recommended by Microsoft. I get the collection: _collection = database.GetCollection<object>("shared").OfType<T>(); When I insert a document the document the configured discriminator is used Works: But when I try to query the collection the discriminator is always "FullTypeName, Assemby". Doesn't work: So the configured discriminator value is never used. Currently it works by setting to discriminator to the value used by the query. //does not support nested types But we like to give a more functional names to the discriminator which don't break if we refactor. I had a quick look and it seems that the filter of the OfTypeMongoCollection is not passed to the MongoQueryableImpl. And to can probably solved using a default expression that filters on the configured discriminator type. Is this something that need to be supported by the library? Any feedback is appriciated! Tim |
| Comments |
| Comment by Rachelle Palmer [ 25/Jun/20 ] |
|
Hi there, thank you for reaching out to MongoDB. As this sounds more like a support issue, I wanted to give you some resources to get this question answered more quickly:
Thank you! |
| Comment by James Turner [ 15/May/19 ] |
|
This sounds very much like CSHARP-1907 with discriminators not being handled consistently.
|