-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
Dotnet Drivers
Hello,
I'm using GetType on a document field and it works but I've found it translates to a check against every level of the type hierarchy. Usually when you do an OfType style filter it only checks for the last type discriminator if the _t field is an array (for document types):
{"$match": {"_t": "SomeOrg.SomeType"}}
but for the subfield it translates to:
{"$match": {"Field._t":
{ "$size": 3 }, "Field._t.0": "SomeOrg.Base", "Field._t.1": "SomeOrg.Parent", "Field._t.2": "SomeOrg.Derived" }}
The above also seems unable to leverage an index on "Field._t" whereas the first one can.
Is this intentional? The translator looks to have been added in CSHARP-4691 and there's a comment on the source ("don't match subclasses") that suggests it's just meant to be testing the final discriminator like the other type comparisons instead of the full array.
Many thanks