Prisma & CockroachDB - push to array

next 12, prisma 4.7.1, CockroachDB

When I try to push an item to an array field, I get an error: "Did you mean set?":

  await prisma.character.update({
    where: {
      id: connectionId,
    },
    data: {
      [connectionField]: {
        push: characterId,
      },
    },
  });


But it works like this:
  const character = await prisma.character.findUnique({
    where: {
      id: connectionId,
    },
  });

  if (character) {
    character[connectionField].push(characterId);

    const updatedCharacter = await prisma.character.update({
      where: {
        id: connectionId,
      },
      data: {
        [connectionField]: character[connectionField],
      },
    });
    return updatedCharacter;
  }
Was this page helpful?