Does anyone know how to use `set` with no items? S...
# orm-help
t
Does anyone know how to use
set
with no items? So it works if you have two things and then take one away. But you can’t just pass it an empty array (or null, I tried), it just ignores it, and doesn’t disconnect anything. If you can’t make
set
disconnect everything, it kinda feels broken to even use it most of the time…
Copy code
query updateUser {
    updateUser (
        where: {
            id: "asdfasdlfkjasdlfkj"
        }
        data: {
            posts: {
                set: [] // < ---- What can you pass here to disconnect all relations?
            }
        }
    ) {
        id
    }
}
y
set: []
works for me.
t
@yogivan…. thank you!! for whatever reason I thought it wasn’t working. I guess I was doing something differently before and attributed it to the wrong thing. You made me check it again and it’s working with an empty array. Been stuck on this for a while
It just wasn’t clear in the documentation that is how it works, so I was second guessing it was even possible