You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Re-add unsafe compatability with unreleased root operators
From [@dariakp](https://github.com/dariakp):
> ... the reason we have RootFilterOperators extend Document is so that
> any driver version can be forwards compatible with new query operators
> that are continually being added to the server. There is an
> improvement that we would love to make to only extend $-prefixed keys
> instead of the generic Document (since operators are always
> $-prefixed), but we haven't had a chance to look into making that
> work.
Here we introduce such a type, but in a much more restricted format than
the `BSON.Document` type formerly extended:
- This is scoped explicitly to keys prefixed with `$`
- We can use the `unknown` type instead of `any`; in the event that a
user is attempting to extract a value from an object typed as a
`Filter<TSchema>` and use it somewhere they will be notified that it
is not type safe and required to use a type cast or other workaround.
Follow-ups:
- Consider preferring safety of existing types over compatibility with
with future operators (https://jira.mongodb.org/browse/NODE-3904)
0 commit comments