nodejs-backend-architecture-typescript icon indicating copy to clipboard operation
nodejs-backend-architecture-typescript copied to clipboard

Issue using Mongoose 5.12

Open capewaterAP opened this issue 4 years ago • 1 comments

Hi,

I tried to bump mongoose to 5.12 but I'm a newbie and I can't do it right.

I continue to have compiling errors like this :

Type 'LeanDocument<Blog>' is missing the following properties from type 'Blog': $getAllSubdocs, $ignore, $isDefault, $isDeleted, and 48 more.ts(2740) Type 'Promise<Blog>' is not assignable to type 'Promise<Blog[]>'. Type 'Blog' is missing the following properties from type 'Blog[]': length, pop, push, concat, and 28 more.ts(2322)

Could someone eventually check and propose a fix?

Regards

capewaterAP avatar May 20 '21 17:05 capewaterAP

Hi,

I tried to bump mongoose to 5.12 but I'm a newbie and I can't do it right.

I continue to have compiling errors like this :

Type 'LeanDocument' is missing the following properties from type 'Blog': $getAllSubdocs, $ignore, $isDefault, $isDeleted, and 48 more.ts(2740) Type 'Promise' is not assignable to type 'Promise<Blog[]>'. Type 'Blog' is missing the following properties from type 'Blog[]': length, pop, push, concat, and 28 more.ts(2322)

Could someone eventually check and propose a fix?

Regards

change .lean<Blog>() to .lean<Blog[]>() whereever you are getting that error.

luckyycool avatar Jan 09 '22 07:01 luckyycool