mongoosejs / mongoose-lean-virtuals

Attach virtuals to the results of mongoose lean() queries
Apache License 2.0
45 stars 24 forks source link

virtuals population not working with cursor() in mongoose 5 #21

Closed wellcaffeinated closed 5 years ago

wellcaffeinated commented 5 years ago

I had a piece of code that did

let query = Model.find({ foo: 'bar' }).setOptions( opts ).lean({ virtuals: true })
let cursor = query.cursor()
//...
let doc = cursor.next()

And in 4.x it worked with virtuals populated. Not so in mongoose 5.x.

Thanks!

vkarpov15 commented 5 years ago

Fixed and released v0.4.1. Thanks for reporting this issue :+1: