© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago•
3 replies
piscopancer

use `count` in db.query?

export function queryQuestions() {
  return db.query.questionsTable.findMany({
    limit: 5,
    orderBy: ({ createdAt }, { desc }) => desc(createdAt),
    with: {
      author: true,
      answers: {
        extras: //
      } 
    },
  })
}
export function queryQuestions() {
  return db.query.questionsTable.findMany({
    limit: 5,
    orderBy: ({ createdAt }, { desc }) => desc(createdAt),
    with: {
      author: true,
      answers: {
        extras: //
      } 
    },
  })
}

I am not fully understanding the API, require support
Solution
https://orm.drizzle.team/docs/rqb#include-custom-fields


As of now aggregations are not supported in extras
Drizzle ORM - Query
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Jump to solution
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Need a way to perform count using db.query, or db.select() using db.query args
Drizzle TeamDTDrizzle Team / help
3y ago
Unable to use db.query... functions
Drizzle TeamDTDrizzle Team / help
14mo ago
Help Needed: Adding Message Count and Filtering by UserId in DB Query
Drizzle TeamDTDrizzle Team / help
3y ago
Unable to use db.query but able to use reqular db.select
Drizzle TeamDTDrizzle Team / help
3y ago