Skip to main content
Glama

Prisma MCP Server

Official
by prisma
Apache 2.0
4
44,231
  • Linux
  • Apple
findFirst.ts2.01 kB
import { faker } from '@faker-js/faker' import { setupTestSuite } from './_matrix' import { commentDataA } from './_testData' // @ts-ignore import type { PrismaClient } from './generated/prisma/client' declare let prisma: PrismaClient const id = faker.database.mongodbObjectId() setupTestSuite(() => { beforeAll(async () => { await prisma.comment.create({ data: commentDataA(id) }) }) test('simple', async () => { const comment = await prisma.comment.findFirst({ where: { id }, }) expect(comment).toMatchInlineSnapshot( { id: expect.any(String) }, ` { "content": { "text": "Hello World", "upvotes": [ { "userId": "10", "vote": true, }, ], }, "country": null, "id": Any<String>, } `, ) }) test('select', async () => { const comment = await prisma.comment.findFirst({ where: { id }, select: { content: { select: { text: true, }, }, }, }) expect(comment).toMatchInlineSnapshot(` { "content": { "text": "Hello World", }, } `) }) test('orderBy', async () => { const comment = await prisma.comment.findFirst({ where: { id }, orderBy: { content: { upvotes: { _count: 'desc', }, }, }, }) expect(comment).toMatchInlineSnapshot( { id: expect.any(String) }, ` { "content": { "text": "Hello World", "upvotes": [ { "userId": "10", "vote": true, }, ], }, "country": null, "id": Any<String>, } `, ) }) test('filter isSet', async () => { const comment = await prisma.comment.findFirst({ where: { id, country: { isSet: true } }, }) expect(comment).toBeNull() }) })

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/prisma/prisma'

If you have feedback or need assistance with the MCP directory API, please join our Discord server