Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MongoDB .env example and schema for prisma #18

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .env.example-mongodb
Original file line number Diff line number Diff line change
@@ -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://<name>:<password>[email protected]/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
8 changes: 4 additions & 4 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions prisma/schema.prisma-mongodb
Original file line number Diff line number Diff line change
@@ -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")
}