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

feat(MongoDB Node): Add projection to query options on Find #9972

Merged
merged 4 commits into from
Aug 7, 2024

Conversation

mickaelandrieu
Copy link
Contributor

@mickaelandrieu mickaelandrieu commented Jul 8, 2024

Summary

This contribution introduces the support of projections for the official MongoDB node.
The main intent is to reduce the time and ressources to retrieve documents.

projection

Related Linear tickets, Github issues, and Community forum posts

=> #6975

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@CLAassistant
Copy link

CLAassistant commented Jul 8, 2024

CLA assistant check
All committers have signed the CLA.

@mickaelandrieu
Copy link
Contributor Author

AFAIK there is no tests at all on this node, but if you help me to help you, I can try to write some.

Copy link
Member

@Joffcom Joffcom left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, I have left a couple of notes.

packages/nodes-base/nodes/MongoDb/MongoDb.node.json Outdated Show resolved Hide resolved
packages/nodes-base/nodes/MongoDb/MongoDb.node.ts Outdated Show resolved Hide resolved
packages/nodes-base/nodes/MongoDb/MongoDb.node.ts Outdated Show resolved Hide resolved
packages/nodes-base/nodes/MongoDb/MongoDbProperties.ts Outdated Show resolved Hide resolved
@n8n-assistant n8n-assistant bot added community Authored by a community member node/improvement New feature or request in linear Issue or PR has been created in Linear for internal review labels Jul 8, 2024
@mickaelandrieu
Copy link
Contributor Author

Thanks for the review, I've improved my contribution

@mickaelandrieu mickaelandrieu changed the title feat(MongoDB node): Introduce projection mechanism feat(MongoDB node): Added projection to query options on Find Jul 10, 2024
@mickaelandrieu mickaelandrieu changed the title feat(MongoDB node): Added projection to query options on Find feat(MongoDB Node): Added projection to query options on Find Jul 10, 2024
@Joffcom Joffcom changed the title feat(MongoDB Node): Added projection to query options on Find feat(MongoDB Node): Add projection to query options on Find Jul 16, 2024
@mickaelandrieu
Copy link
Contributor Author

Hi, just a friendly reminder (also I really need this feature to be added in the core 🙏)

@Joffcom
Copy link
Member

Joffcom commented Aug 1, 2024

Hey @mickaelandrieu,

I have fixed the remaining lint issues so we can get this merged. Thanks for the work you have done on this.

@mickaelandrieu
Copy link
Contributor Author

mickaelandrieu commented Aug 1, 2024

Thanks !
I tried to use a linter with vs code with no success.

Always happy to help 👍

Can you help me to update the docs ? I don't know where it's located (same repository ?)

@Joffcom
Copy link
Member

Joffcom commented Aug 7, 2024

Hey @mickaelandrieu,

The docs are under n8n-io/n8n-docs but I don't think this change needs a docs update so we are all good.

@Joffcom Joffcom merged commit 0a84e0d into n8n-io:master Aug 7, 2024
9 checks passed
@github-actions github-actions bot mentioned this pull request Aug 7, 2024
@janober
Copy link
Member

janober commented Aug 7, 2024

Got released with n8n@1.54.0

@mickaelandrieu mickaelandrieu deleted the mongodb/projection-support branch August 7, 2024 11:26
MiloradFilipovic added a commit that referenced this pull request Aug 7, 2024
* master:
  refactor(core): Centralize scaling mode (no-changelog) (#9835)
  fix(editor): Remove body padding from storybook previews (no-changelog) (#10317)
  feat(MySQL Node): Return decimal types as numbers (#10313)
  🚀 Release 1.54.0 (#10315)
  feat(Elasticsearch Node): Add bulk operations for Elasticsearch (#9940)
  feat(Stripe Trigger Node): Add Stripe webhook descriptions based on the workflow ID and name (#9956)
  feat(MongoDB Node): Add projection to query options on Find (#9972)
  fix(Invoice Ninja Node): Fix payment types (#10196)
  feat(HTTP Request Tool Node): Use DynamicStructuredTool with models supporting it (no-changelog) (#10246)
  feat: Return scopes on executions (no-changelog) (#10310)
  feat(Webflow Node): Update to use the v2 API (#9996)
  feat(Lemlist Trigger Node): Update Trigger events (#10311)
  feat(Calendly Trigger Node): Update event names (no-changelog) (#10129)
  refactor(core): Reorganize webhook related components under src/webhooks (no-changelog) (#10296)
  docs: Fix links to license files in readme (no-changelog) (#10257)
  fix(editor): Update design system Avatar component to show initials also when only firstName or lastName is given (#10308)
  fix(editor): Update tags filter/editor to not show non existing tag as a selectable option (#10297)
  fix(editor): Update project tabs test (no-changelog) (#10300)
  fix(core): VM2 sandbox should not throw on `new Promise` (#10298)

# Conflicts:
#	packages/design-system/src/components/N8nAvatar/Avatar.vue
@@ -208,6 +210,10 @@ export class MongoDb implements INodeType {
query = query.sort(sort);
}

if (projection && projection instanceof Document) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @Joffcom, I'm sorry but it looks like this object is never imported and came from bson module (which is not a direct dependency).

I'm wondering why calling a projection throws a "Document is not defined" error, but not all the previous calls in this file : what do I have done wrong, here ? :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Authored by a community member in linear Issue or PR has been created in Linear for internal review node/improvement New feature or request Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants