Skip to content

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

Closed
@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

    typescriptTypes or Types-test related issue / Pull Request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions