Serverless
Serverless
DTDrizzle Team
Created by Serverless on 6/1/2023 in #help
Is there a way to limit update to just 1 document?
I know there will be multiple documents matching this where query, but I only want to update 1 of them at a time.
export const joinTable = async (tableId: number, seatedPlayerId: number) => {
await db
.update(tableSeats)
.set({ seatedPlayerId })
.where(and(eq(tableSeats.tableId, tableId), isNull(tableSeats.seatedPlayerId)));
};
export const joinTable = async (tableId: number, seatedPlayerId: number) => {
await db
.update(tableSeats)
.set({ seatedPlayerId })
.where(and(eq(tableSeats.tableId, tableId), isNull(tableSeats.seatedPlayerId)));
};
Any ideas on how I would accomplish that? I feel like limit should potentially be an option on update
5 replies