Inserting an array into mysql database as Json using prisma

217 Views Asked by At

As in the title, I am trying to insert an array into mysql as Json using prisma

model test {
  id               Int        @id @default(autoincrement())
  prices           Json?      @db.Json
}

const prices = [{category: "A", price: 11}, {category: "B", price: 8}, {category: "C", price: 11},…]

But I receive the following error

Expected priceUpdateManyWithoutShowNestedInput or priceUncheckedUpdateManyWithoutShowNestedInput, provided (Object, Object, Object, Object, Object).

When using JSON.stringify, I receive the same error: I am trying to enter a String

thank you

0

There are 0 best solutions below