Skip to content

How to type QueryWithHelpers so that it returns both HydratedDocument and FlattenMaps? #15311

Open
@nikzanda

Description

@nikzanda

Prerequisites

  • I have written a descriptive issue title

Mongoose version

8.12.1

Node.js version

20.10.0

MongoDB version

6.0.2

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

No response

Issue

In the example provided in the documentation, the query helper byName returns a HydratedDocument of Project. However, if the query is lean, it should consequently return the FlattenMaps type. How can the typing be corrected?"

Reproduction link here.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    helpThis issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessaryhelp wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions