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
When assigning the option typeKey to a Schema decorator it gives the following warning.
(property) SchemaOptions<"type", unknown, {}, {}, {}, {}>.typeKey?: "type" | undefined
By default, if you have an object with key 'type' in your schema, mongoose will interpret it as a type declaration. However, for applications like geoJSON, the 'type' property is important. If you want to control which key mongoose uses to find type declarations, set the 'typeKey' schema option.
Type '"$type"' is not assignable to type '"type"'.ts(2322)
It is a change done in the Mongoose package itself. Previously typeKey was typed as a string. In one of the later versions they changed it. April 20th vs Change
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Current behavior
When assigning the option
typeKey
to a Schema decorator it gives the following warning.Minimum reproduction code
https://gist.github.com/Shikakka/e3ceef24128d63b7b40368cd9ed7c518
Steps to reproduce
No response
Expected behavior
Apply the typeKey correctly, like the Mongoose package itself does. Using
$type
as the typeKey:Package version
9.1.1
mongoose version
6.4.1
NestJS version
8.4.7
Node.js version
16.15.1
In which operating systems have you tested?
Other
It is a change done in the Mongoose package itself. Previously typeKey was typed as a
string
. In one of the later versions they changed it.April 20th vs Change
The text was updated successfully, but these errors were encountered: