From 3b27177389610cd74096c69927682e316bcc2bf5 Mon Sep 17 00:00:00 2001 From: nikugogoi Date: Thu, 14 Oct 2021 17:19:25 +0530 Subject: [PATCH] Fix query when filtering by bigint type field (#268) --- packages/util/src/database.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/util/src/database.ts b/packages/util/src/database.ts index 6623ad40..6f218bc0 100644 --- a/packages/util/src/database.ts +++ b/packages/util/src/database.ts @@ -382,7 +382,7 @@ export class Database { Object.entries(where).forEach(([field, filters]) => { filters.forEach((filter, index) => { // Form the where clause. - const { not, operator, value } = filter; + let { not, operator, value } = filter; const columnMetadata = repo.metadata.findColumnWithPropertyName(field); assert(columnMetadata); let whereClause = `${tableName}.${columnMetadata.propertyAliasName} `; @@ -402,6 +402,9 @@ export class Database { } else if (operator === 'in') { whereClause += '(:...'; } else { + // Convert to string type value as bigint type throws error in query. + value = value.toString(); + whereClause += ':'; }