Skip to content

Commit 9b4635e

Browse files
committed
fix(query): ensure fields are unique in query
1 parent 8ae885d commit 9b4635e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/runtime/internal/query.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ export const collectionQureyBuilder = <T extends keyof Collections>(collection:
9898
query += `COUNT(${opts.count.distinct ? 'DISTINCT' : ''} ${opts.count.field}) as count`
9999
}
100100
else {
101-
query += params.selectedFields.length > 0 ? params.selectedFields.map(f => `"${String(f)}"`).join(', ') : '*'
101+
const fields = Array.from(new Set(params.selectedFields))
102+
query += fields.length > 0 ? fields.map(f => `"${String(f)}"`).join(', ') : '*'
102103
}
103104
query += ` FROM ${tables[String(collection)]}`
104105

0 commit comments

Comments
 (0)