Deleting a record with a list field of scalar values always returns empty array



I’m trying to build a simple application that has an Item model which looks like this:

type Item {
    id: ID! @unique
    name: String!
    description: String
    price: Float!
    quantity: Int! @default(value: "1")
    images: [String!]!

As per the docs, deleting an item object from the database through the Prisma client, should delete it and return all the scalar fields. But when I try to do that, it does not return the correct value for images field. That field always returns an empty list [], even if the object itself had a non-empty list.

Code snippets:

const item = {
    name: 'Some item',
    description: 'Some description',
    price: 273.0,
    quantity: 20,
    images: [

const { id } = await prisma.createItem({ ...item, images: { set: item.images } })

const itemInDb = await prisma.item({ id })
console.log(itemInDb.images) // prints "['http://...', 'http://....', 'http://....']"

const deletedItem = await prisma.deleteItem({ id })
console.log(deletedItem.images) //  prints "[]"

Hence, I’m wondering: is this the intended behavior, or is it a bug? Is there anyway that I could get the entire list of images while doing the delete operation, and without doing a lookup for the item first?


Hi @mohitsakhuja

This is indeed a bug, can you please report this on github:



Thanks @pantharshit00 for replying and opening the issue. But from Matthias’ reply over on GitHub, it’s the intended behavior for now, right?


Yes, for now this is necessary to improve speeds


This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.