redis-oplog icon indicating copy to clipboard operation
redis-oplog copied to clipboard

fix: ignore undefined and null params on modifiers

Open xolott opened this issue 1 year ago • 2 comments

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

xolott avatar Sep 28 '23 20:09 xolott

Strange that the tests didn't run.

StorytellerCZ avatar Feb 28 '24 10:02 StorytellerCZ

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

StorytellerCZ avatar Apr 08 '24 15:04 StorytellerCZ