Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The property justOne in PopulateOptions states an error #12599

Closed
2 tasks done
tianguangcn opened this issue Oct 26, 2022 · 2 comments · Fixed by #12686
Closed
2 tasks done

The property justOne in PopulateOptions states an error #12599

tianguangcn opened this issue Oct 26, 2022 · 2 comments · Fixed by #12686
Labels
typescript Types or Types-test related issue / Pull Request
Milestone

Comments

@tianguangcn
Copy link

tianguangcn commented Oct 26, 2022

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

6.7.0

Node.js version

16.x

MongoDB server version

4.9.1

Typescript version (if applicable)

^4.5.3

Description

The property justOne in PopulateOptions states an error

    /**
     * If true Mongoose will always set `path` to an array, if false Mongoose will
     * always set `path` to a document. Inferred from schema by default.
     */
     justOne?: boolean;

When justOne is set false, the result is an array, true will retrun a document.

Steps to Reproduce

set justOne:false and justOne:true ,
the result does not match the document description

Expected Behavior

The property justOne in PopulateOptions states an error ?
Determine if it is a bug, hope to update the documentation and code source code

@tianguangcn
Copy link
Author

I had a hard time following the official documentation when using PopulateOptions, and the results of my attempts were always inconsistent with the documentation.

@hasezoey
Copy link
Collaborator

to clarify, you are not asking about a "error" but a incorrect type, correct? if it is actually a error, please provide the error (and a code example would be good too)

@hasezoey hasezoey added the typescript Types or Types-test related issue / Pull Request label Oct 31, 2022
@vkarpov15 vkarpov15 modified the milestones: 6.7.2, 6.7.3 Nov 7, 2022
hasezoey added a commit that referenced this issue Nov 21, 2022
docs: fix inverted explanation of `justOne` option for populate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typescript Types or Types-test related issue / Pull Request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants