VibORM
Mutations

Mutation Operations

Create, update, and delete data

Mutation Operations

Mutations modify data in your database.

Overview

OperationDescriptionReturns
createCreate a single recordT
createManyCreate multiple records{ count }
updateUpdate a single recordT
updateManyUpdate multiple records{ count }
deleteDelete a single recordT
deleteManyDelete multiple records{ count }
upsertCreate or updateT

Quick Examples

// Create
const user = await client.user.create({
  data: { email: "alice@example.com", name: "Alice" },
});

// Update
await client.user.update({
  where: { id: "user_123" },
  data: { name: "Alice Smith" },
});

// Delete
await client.user.delete({
  where: { id: "user_123" },
});

// Upsert
await client.user.upsert({
  where: { email: "alice@example.com" },
  create: { email: "alice@example.com", name: "Alice" },
  update: { name: "Alice Updated" },
});

Pages

On this page