mongodb-js / mongoose-autopopulate

Always populate() certain fields in your mongoose schemas
Apache License 2.0
222 stars 36 forks source link

Does not work with Mongoose >= v5.12.14 #85

Closed drover25 closed 3 years ago

drover25 commented 3 years ago

Mongoose 5.12.14 introduced the new VirtualTypeOptions type for populate methods. https://github.com/Automattic/mongoose/pull/10350

This leads to compilation issues when adding autopopulate to these options

: error TS2345: Argument of type '{ ref: string; localField: string; foreignField: string; justOne: false; autopopulate: boolean; }' is not assignable to parameter of type 'VirtualTypeOptions'.
  Object literal may only specify known properties, and 'autopopulate' does not exist in type 'VirtualTypeOptions'.
vkarpov15 commented 3 years ago

Fix will be in Mongoose 5.13.2. Sorry for the inconvenience!