James
James
Explore posts from servers
DTDrizzle Team
Created by James on 10/11/2024 in #help
$returningId returning extra rows
Not sure if this is intended behaviour but with the mysql2 driver in drizzle-orm this:
console.log(await db.insert(table).values([row1, row2]).$returningId())
console.log(await db.insert(table).values([row1, row2]).$returningId())
Outputs
[
{
id: 1,
}, {
id: undefined,
}, {
id: 2,
}, {
id: undefined,
}
]
[
{
id: 1,
}, {
id: undefined,
}, {
id: 2,
}, {
id: undefined,
}
]
When I'd expect it to output
[
{
id: 1,
}, {
id: 2,
}
]
[
{
id: 1,
}, {
id: 2,
}
]
Any help is appreciated!
3 replies