Skip to content

Commit

Permalink
fix(query): ensure fields are unique in query
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Nov 26, 2024
1 parent 8ae885d commit 9b4635e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/runtime/internal/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ export const collectionQureyBuilder = <T extends keyof Collections>(collection:
query += `COUNT(${opts.count.distinct ? 'DISTINCT' : ''} ${opts.count.field}) as count`
}
else {
query += params.selectedFields.length > 0 ? params.selectedFields.map(f => `"${String(f)}"`).join(', ') : '*'
const fields = Array.from(new Set(params.selectedFields))
query += fields.length > 0 ? fields.map(f => `"${String(f)}"`).join(', ') : '*'
}
query += ` FROM ${tables[String(collection)]}`

Expand Down

0 comments on commit 9b4635e

Please sign in to comment.