Skip to content

Commit

Permalink
fix(db-ql): fix binary object serialize bug
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Oct 16, 2021
1 parent dbeb55a commit 5c28d8d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/database-ql/src/serializer/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getType, isObject, isArray, isDate, isRegExp, isInternalObject, isObjectId } from '../utils/type'
import { getType, isObject, isArray, isDate, isRegExp, isInternalObject, isObjectId, isBinary } from '../utils/type'
import { serialize as serializeInternalDataType, deserialize as deserializeInternalDataType } from './datatype'
import { LogicCommand } from '../commands/logic'

Expand Down Expand Up @@ -99,13 +99,15 @@ export function mergeConditionAfterEncode(query: Record<string, any>, condition:
}

/**
* Check `val` if `InternalObject` | `Date` | `RegExp` | `ObjectId`
* Check `val` if `InternalObject` | `Date` | `RegExp` | `ObjectId` | `isBinary`
* InternalObject can be: `LogicCommand` | `QueryCommand` | `UpdateCommand`
*
* @tip this method also used is `flatten()` function, `flatten` will reserved the required object
* @param val
* @returns
*/
export function isConversionRequired(val: any): boolean {
return isInternalObject(val) || isDate(val) || isRegExp(val) || isObjectId(val)
return isInternalObject(val) || isDate(val) || isRegExp(val) || isObjectId(val) || isBinary(val)
}

export function encodeInternalDataType(val: any): IQueryCondition {
Expand Down

0 comments on commit 5c28d8d

Please sign in to comment.