Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Prisma · Module

updateManyAndReturn

updateManyAndReturn() updates multiple matching records and returns the resulting objects. Prisma documents it for PostgreSQL, CockroachDB, and SQLite in Prisma ORM 6.2.0 and later.

Since
6.2.0

How it works

Call the generated model method with a filter in where and the changes in data. It updates every matching record and returns the resulting objects, making the changed rows available immediately instead of only reporting how many rows were affected.

Syntax

prisma.<model>.updateManyAndReturn({ where?, data, select?, omit? })

Parameters

NameTypeDescription
whereUserWhereInputFilter identifying the records to update.
dataUserUpdateManyMutationInputValues and supported update operations applied to each matching record.

Returns

An array of the updated model records.

Key points

  • The operation combines a bulk update with retrieval of the resulting records.
  • It was introduced in Prisma ORM 6.2.0.
  • The documented database providers are PostgreSQL, CockroachDB, and SQLite.
  • Use the generated model delegate, such as prisma.user, to invoke it.

Common mistakes

  • The join relation load strategy cannot be used with this operation.

Example: Update and return matching users

const users = await prisma.user.updateManyAndReturn({
  where: { email: { contains: "prisma.io" } },
  data: { role: "ADMIN" },
});

Updates matching users and returns their updated records.

When to use it

Update and consume changed records

A batch change must immediately be sent to another service or displayed to a caller.

Bulk maintenance with returned rows

A migration or administration task changes a filtered group of rows.

Filtered mass update

An application applies the same field change to all records matching a condition.

Interview questions

QWhat does updateManyAndReturn() do, and how does it differ from updateMany()?

It updates multiple records selected by where and returns the resulting objects. Unlike updateMany(), which returns only the number of updated records, this method returns the updated rows.

Follow-up: Which databases support it? Prisma documents support for PostgreSQL, CockroachDB, and SQLite.

QWhen was this feature introduced?

The method is available starting with Prisma ORM 6.2.0. Its returned value is a list of the updated model objects, subject to the operation's selection options.

Follow-up: What should be checked before adopting it in a project? Confirm the Prisma ORM version and database provider meet the documented support requirements.

QHow are the input arguments structured?

Use where to identify the records and data to specify the update applied to each match. For example, an email filter can select users while data changes their role.

Follow-up: How can relation loading affect the call? The documented join relation load strategy is unavailable for this method.

  • updateMany()
  • createManyAndReturn()
  • deleteMany()
  • where
  • data
  • relationLoadStrategy

Source: Prisma Client API reference. Checked 2026-10-16.