diff --git a/.changeset/yellow-carpets-jam.md b/.changeset/yellow-carpets-jam.md new file mode 100644 index 0000000000..1479e5edbe --- /dev/null +++ b/.changeset/yellow-carpets-jam.md @@ -0,0 +1,5 @@ +--- +"@medusajs/utils": patch +--- + +chore(medusa): Align build query utils diff --git a/packages/utils/src/common/build-query.ts b/packages/utils/src/common/build-query.ts index 71495e785b..4f3ceb41db 100644 --- a/packages/utils/src/common/build-query.ts +++ b/packages/utils/src/common/build-query.ts @@ -122,14 +122,18 @@ function buildWhere( break default: if (objectValue != undefined && typeof objectValue === "object") { - where[key].push(buildWhere(objectValue)) + where[key] = buildWhere(objectValue) return } - where[key].push(value) + where[key] = value } return }) + if (!Array.isArray(where[key])) { + continue + } + if (where[key].length === 1) { where[key] = where[key][0] } else {