Skip to content

Commit

Permalink
ensure that numerical operations with null work like MongoDB
Browse files Browse the repository at this point in the history
  • Loading branch information
crcn committed Mar 4, 2023
1 parent e1c4e1a commit 26ebd5e
Show file tree
Hide file tree
Showing 3 changed files with 1,359 additions and 1,393 deletions.
4 changes: 2 additions & 2 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ export const createEqualsOperation = (

export class NopeOperation<TParam> extends BaseOperation<TParam> {
readonly propop = true;
next() {
next(item) {
this.done = true;
this.keep = false;
this.keep = item == null;
}
}

Expand Down
1 change: 1 addition & 0 deletions test/operations-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ describe(__filename + "#", function() {
[{ $lte: 5 }, [3, 4, 5, 6], [3, 4, 5], false],
[{ $lte: "5" }, [4, 3, 2, 1], [], false],
[{ $lte: "5" }, ["4", "3", "2"], ["4", "3", "2"], false],
[{ ab: { $lte: null } }, [{ ab: 5 }, { cd: 5 }], [{ cd: 5 }], false],
[
{ groups: { $lt: 5 } },
[{ groups: [1, 2, 3, 4] }, { groups: [7, 8] }],
Expand Down
Loading

0 comments on commit 26ebd5e

Please sign in to comment.