8000 docs: add TypeScript Query guide with info on `lean()` + `transform()` by vkarpov15 · Pull Request #15377 · Automattic/mongoose · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

docs: add TypeScript Query guide with info on lean() + transform() #15377

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

Merged
merged 1 commit into from
Apr 29, 2025

Conversation

vkarpov15
Copy link
Collaborator

Fix #15311

Summary

Add some recommendations on how to use lean() and transform() together based on discussion from #15311. Also good to have a "Queries" page for more info on how to use queries in TypeScript.

Examples

@vkarpov15 vkarpov15 added this to the 8.14.1 milestone Apr 28, 2025
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the documentation by adding a guide for using Mongoose queries in TypeScript, especially focusing on recommendations for ordering the use of lean() and transform().

  • Added a new "Queries in TypeScript" section
  • Provided code examples demonstrating the proper use and common pitfalls of chaining lean() and transform()
  • Clarified the recommendation to call lean() before transform() for proper type inference
Files not reviewed (1)
  • docs/layout.pug: Language not supported

@hasezoey hasezoey added docs This issue is due to a mistake or omission in the mongoosejs.com documentation typescript Types or Types-test related issue / Pull Request labels Apr 29, 2025
@vkarpov15 vkarpov15 merged commit 55eef44 into master Apr 29, 2025
3 checks passed
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-15311 branch April 29, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation typescript Types or Types-test related issue / Pull Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to type QueryWithHelpers so that it returns both HydratedDocument and FlattenMaps?
2 participants
0