Skip to content

Add possibility to make .lean() in populate itself #1382

@skotchio

Description

@skotchio

It could be good for performance if you add populate lean() to .populate() method itself. So if we use populate at now like the following:

Model.find({ type: 'paper' }).lean().populate('batch').exec(fn)

We get documents with type 'paper' as just JavaScript objects but 'patch' as fully functional mongoose document. It could be cool if we could make something like the following:

Model.find({ type: 'paper' }).lean().populate('batch', {lean: true}).exec(fn)

Now all documents are just JavaScript object. What do you think about it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugWe've confirmed this is a bug in Mongoose and will fix it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions