prisma / docs

📚 Prisma Documentation
https://www.prisma.io/docs
Apache License 2.0
982 stars 776 forks source link

Document that MongoDB only allows 1 `@@fulltext` index #2729

Open janpio opened 2 years ago

janpio commented 2 years ago
generator js {
  provider        = "prisma-client-js"
  previewFeatures = ["fullTextIndex", "extendedIndexes", "mongoDb"]
}

datasource db {
  provider = "mongodb"
  url      = env("DATABASE_URL")
}

model Post {
  id      String @id @map("_id") @db.ObjectId
  title   String
  content String

  @@fulltext([title(sort: Desc), content])
  @@fulltext([title])
}

leads to

>npx prisma validate
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Error: Schema parsing
error: Error parsing attribute "@fulltext": The current connector only allows one fulltext attribute per model
  -->  schema.prisma:16
   | 
15 | 
16 |   @@fulltext([title(sort: Desc), content])
   | 
error: Error parsing attribute "@fulltext": The current connector only allows one fulltext attribute per model
  -->  schema.prisma:17
   | 
16 |   @@fulltext([title(sort: Desc), content])
17 |   @@fulltext([title])
   | 

Validation Error Count: 2

Probably on https://www.prisma.io/docs/concepts/components/prisma-schema/indexes

matthewmueller commented 2 years ago

I'd personally avoid mentioning this at all since we don't yet support full-text query support in MongoDB

janpio commented 2 years ago

This is about the fulltext index, which is supported (and introspected). So where we document @@fulltext we also should mention this limitation of the feature compared to other connectors.