Avraj
Avraj
Explore posts from servers
DTDrizzle Team
Created by Avraj on 12/25/2023 in #help
Update and return a single row only when using .update()?
Hi, I have the following drizzle code which updates levels in a table.
const updatedLevel = await db
.update(levels)
.set(queriedLevel)
.where(
and(
eq(levels.userId, user_id),
eq(levels.guildId, guild_id)
)
)
.returning();
const updatedLevel = await db
.update(levels)
.set(queriedLevel)
.where(
and(
eq(levels.userId, user_id),
eq(levels.guildId, guild_id)
)
)
.returning();
Is it possible to only update a single row in the levels table instead of all that match the where clause? I'm asking this because I want the returning() value to be a single object instead of an array of objects. I'm fairly new to pg and drizzle so I apologise if it's a silly question xD
5 replies