Link Search Menu Expand Document

Prisma

In the Prisma schema you define your data source, like a PostgreSQL database, and models, like users and posts and the relations between them. Using this schema, Prisma generates a type-safe Client that exposes a Create-Read-Update-Delete (CRUD) API, which you then use to query your database.

This Prisma Client functions as a rich query builder that you can use in your Node.js app to return plain JavaScript objects, not instances of a model class.

const usersWithPartialPosts = await prisma.user.findMany({
  include: {
    posts: {
      select: {
        title: true,
        published: true,
      },
    },
  },
})

Copyright © 2020 Thence LLC