Skip to content

Commit

Permalink
fix($convert): add missing BSON type strings
Browse files Browse the repository at this point in the history
  • Loading branch information
kofrasa committed Jan 5, 2025
1 parent c016e97 commit 9c9456d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/operators/_predicates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,19 @@ export function $elemMatch(
const isNull = (a: Any) => a === null;

/** Mapping of type to predicate */
const compareFuncs: Record<number | string, Predicate<Any>> = {
const compareFuncs: Record<ConversionType, Predicate<Any>> = {
array: isArray as Predicate<Any>,
boolean: isBoolean,
bool: isBoolean,
date: isDate,
number: isNumber,
int: isNumber,
long: isNumber,
double: isNumber,
decimal: isNumber,
null: isNull,
object: isObject,
regexp: isRegExp,
regex: isRegExp,
string: isString,
// added for completeness
Expand All @@ -343,8 +349,8 @@ const compareFuncs: Record<number | string, Predicate<Any>> = {
9: isDate,
10: isNull,
11: isRegExp,
16: isNumber,
18: isNumber,
16: isNumber, //int
18: isNumber, //long
19: isNumber //decimal
};

Expand Down

0 comments on commit 9c9456d

Please sign in to comment.