address breaking changes

This commit is contained in:
Thomas Ruoff
2022-03-14 22:35:30 +01:00
committed by Thomas Ruoff
parent 8222e04880
commit ef7f80fd92
10 changed files with 41 additions and 46 deletions

View File

@@ -7,18 +7,12 @@ let connectedPromise: Promise<mongoose.Mongoose>
export const MONGO_URI = process.env.MONGO_URI
export const MONGODB_OPTIONS = {
useCreateIndex: true,
useNewUrlParser: true,
useUnifiedTopology: true,
}
export function connect(): Promise<mongoose.Mongoose> {
if (connectedPromise) {
return connectedPromise
}
connectedPromise = mongoose.connect(process.env.MONGO_URI, MONGODB_OPTIONS)
connectedPromise = mongoose.connect(process.env.MONGO_URI)
return connectedPromise
}