API
API
Common Prisma Next IDB client methods
Reads are built with chainable methods and executed with a terminal call:
const todos = await db.orm.todo.where({ done: false }).orderBy({ title: "asc" }).all();Methods
| Method | Use |
|---|---|
all() | Return matching rows |
first() | Return the first match |
findUnique(key) | Read by primary key |
create(data) | Insert one row |
createAll(data[]) | Insert many rows |
update(patch) | Update the first match |
updateAll(patch) | Update all matches |
upsert(args) | Insert or update one row |
delete(key) | Delete by primary key |
deleteAll() | Delete all matches |
createCount(data[]) | Insert many, return count |
updateCount(patch) | Update many, return count |
deleteCount() | Delete many, return count |
count() | Count matching rows |
aggregate(callback) | Compute aggregate values |
groupBy(...fields) | Group aggregate results |
include(relation) | Load a relation |
select(...fields) | Project scalar fields |