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

fix: ignore undefined and null params on modifiers #399

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xolott
Copy link

@xolott xolott commented Sep 28, 2023

Why?

Sometimes we have a logic like this:

let $set;

if(someCondition) {
    $set = {
        field: 'value',
    };
}
Collection.update(selector, { $set });

The Mongo driver can handle that modifier. It just ignores the $set operation when its value is null or undefined.

Fixes: #398

Changes

  • Ignore operators with null or undefined values
  • Added a test case for this scenario
  • Added the isNil utility function
  • Added a test case for the isNil utility function

@StorytellerCZ
Copy link
Collaborator

Strange that the tests didn't run.

@StorytellerCZ
Copy link
Collaborator

@xolott can you take a look on the tests, now that they have run and failed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception when a modifier with undefined values is used
2 participants