-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
Not Needed
What problem are you facing?
When casting the type of Collection<Document> to an interface made by me, I noticed that the Collection methods still allow me to set properties that do not exist in the Document type. This is due to a bug in mongodb.d.ts line 3713 where it says
```ts
export declare type MatchKeysAndValues<TSchema> = Readonly<Partial<TSchema>> & Record<string, any>;
```
Where it should say
```ts
export declare type MatchKeysAndValues<TSchema> = Readonly<Partial<TSchema>>;
```
Unfortunately this file is not on github for some reason, which doesn't allow me to open a PR to fix it.
What driver and relevant dependency versions are you using?
mongodb v4.1.0
Steps to reproduce?
```ts
interface MyDocument
{ foo: string bar: number }db.collection<MyDocument>("test").insertOne({foo: "value", bar: 0, foobar: "other value"}) //This syntax is completely valid despite "foobar" not existing in the MyDocument interface
```
- related to
-
NODE-3589 Support dot notation types in filter keys
- Closed