-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
What problem are you facing?
Project fails to compile after upgrade to 4.3.1.
What driver and relevant dependency versions are you using?
mongodb 4.3.1
Typescript 4.5.5
Steps to reproduce?
The following code
interface User { _id: string; name: string; } function stringFilter(q: unknown): Filter<User> { const query: Filter<User> = {}; if (q && typeof q === "string") { query.$text = { $search: q, $caseSensitive: false, $diacriticSensitive: false, $language: "en", }; } return query; } const query = stringFilter("search"); let results = collection.find(query);
gives the error "Property '$text' does not exist on type 'Filter<User>'. Property '$text' does not exist on type 'Partial<User>'."
It worked on 4.3.0.