findMany without additional options

When using const results = await db.query.habits.findMany() in my project, results is []. If add any option like
const results = await db.query.habits.findMany({
orderBy: [asc(habits.name)]
})
const results = await db.query.habits.findMany({
orderBy: [asc(habits.name)]
})
I get all habits in the table. Normally findMany() should be enough, shouldn't it? https://orm.drizzle.team/docs/rqb#find-many
3 Replies
Piotrek
Piotrek16mo ago
Shouldn't orderBy be without the brackets? Idk if it's gonna change something but worth trying anyway
MAST
MAST16mo ago
Order by gets an array of orders. So if you need multiple you can put them in an array and pass it here.
Andrii Sherman
Andrii Sherman16mo ago
Seems like a bug If you can print sql queries for both queries you've sent it may help us a lot to debug a problem
Want results from more Discord servers?
Add your server