David Ilizarov
09/26/2022, 5:27 AMprisma.model.update({
where: {
id: 10
},
data: {
array: {
push: [1,2,3,4]
}
}
})
The above would presumably push 4 numbers onto the array on my model.
The documentation says otherwise belowNurul
09/26/2022, 6:45 AMimport { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient({
log: ['query', 'info', 'warn'],
});
async function main() {
await prisma.test.create({
data: {
array: ['1'],
},
});
await prisma.test.update({
where: {
id: 1,
},
data: {
array: {
push: ['2', '3'],
},
},
});
}
main()
.catch((e) => {
throw e;
})
.finally(async () => {
await prisma.$disconnect();
});
Nurul
09/26/2022, 2:40 PM