From b00290fb000d750bf7c2815d8ecc90f91ef6aff6 Mon Sep 17 00:00:00 2001 From: Michael Lynn Date: Sat, 18 May 2024 09:16:01 -0400 Subject: [PATCH 1/2] Add MongoDB .env example and schema for prisma --- .env.example-mongodb | 37 ++++++++++++++++++++++++++++++++++++ prisma/schema.prisma-mongodb | 17 +++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 .env.example-mongodb create mode 100644 prisma/schema.prisma-mongodb diff --git a/.env.example-mongodb b/.env.example-mongodb new file mode 100644 index 0000000..ebef47f --- /dev/null +++ b/.env.example-mongodb @@ -0,0 +1,37 @@ +TOGETHER_AI_API_KEY= +NEXT_PUBLIC_BYTESCALE_API_KEY= + +# The vector store you'd like to use. +# Can be one of "pinecone" or "mongodb" +# Defaults to "pinecone" +NEXT_PUBLIC_VECTORSTORE="mongodb" + +# Update these with your pinecone details from your dashboard. +# Not required if `NEXT_PUBLIC_VECTORSTORE` is set to "mongodb" +PINECONE_API_KEY= +PINECONE_INDEX_NAME= # PINECONE_INDEX_NAME is in the indexes tab under "index name" in blue + +# Update these with your MongoDB Atlas details from your dashboard. +# Not required if `NEXT_PUBLIC_VECTORSTORE` is set to "pinecone" + +# Make sure you include a database name on the end of your connection string +MONGODB_ATLAS_URI=mongodb+srv://:!@cluster0.mrfac8r.mongodb.net/pdftochat +MONGODB_ATLAS_DB_NAME=pdftochat +MONGODB_ATLAS_COLLECTION_NAME=documents +MONGODB_ATLAS_INDEX_NAME=vector_index + + +NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY= +CLERK_SECRET_KEY= + +NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in +NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up + +# POSTGRES_URL= +# POSTGRES_URL_NON_POOLING= +# POSTGRES_PRISMA_URL= + +# Enable tracing via smith.langchain.com +# LANGCHAIN_TRACING_V2=true +# LANGCHAIN_API_KEY= +# LANGCHAIN_SESSION=pdftochat diff --git a/prisma/schema.prisma-mongodb b/prisma/schema.prisma-mongodb new file mode 100644 index 0000000..74b539e --- /dev/null +++ b/prisma/schema.prisma-mongodb @@ -0,0 +1,17 @@ +generator client { + provider = "prisma-client-js" +} + + +datasource db { + provider = "mongodb" + url = env("MONGODB_ATLAS_URI") +} + +model Document { + id String @id @default(auto()) @map("_id") @db.ObjectId + userId String + fileUrl String + fileName String + createdAt DateTime @default(now()) @map(name: "created_at") +} From 1f3996323742b9fcfb8128000d395510451a98d5 Mon Sep 17 00:00:00 2001 From: Michael Lynn Date: Sat, 18 May 2024 11:15:48 -0400 Subject: [PATCH 2/2] Update schema.prisma --- prisma/schema.prisma | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 8d32812..74b539e 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -2,14 +2,14 @@ generator client { provider = "prisma-client-js" } + datasource db { - provider = "postgresql" - url = env("POSTGRES_PRISMA_URL") // uses connection pooling - directUrl = env("POSTGRES_URL_NON_POOLING") // uses a direct connection + provider = "mongodb" + url = env("MONGODB_ATLAS_URI") } model Document { - id String @id @default(cuid()) + id String @id @default(auto()) @map("_id") @db.ObjectId userId String fileUrl String fileName String