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
I have searched existing issues to ensure the bug has not already been reported
Mongoose version
7.x
Node.js version
all
MongoDB server version
all
Typescript version (if applicable)
all
Description
Mongoose does not return a real lean document
Since v7 and the removal of LeanDocument, now when we lean a document mongoose return the raw type defined when we instantiate the schema
But when we are not providing a raw type to the schema and we let mongoose infer the type the returned type is not the good one (for instance for subSchema array)
Prerequisites
Mongoose version
7.x
Node.js version
all
MongoDB server version
all
Typescript version (if applicable)
all
Description
Mongoose does not return a real lean document
Since v7 and the removal of
LeanDocument
, now when we lean a document mongoose return the raw type defined when we instantiate the schemaBut when we are not providing a raw type to the schema and we let mongoose infer the type the returned type is not the good one (for instance for subSchema array)
Steps to Reproduce
The return type for the subSchema is
mongoose.Types.DocumentArray
Typescript playground example
Expected Behavior
The return type for the subSchema is
Array
The text was updated successfully, but these errors were encountered: