auto throw error if findOne doesn't find any doc

This commit is contained in:
Flam3rboy
2021-07-10 17:51:19 +02:00
parent d4550a567a
commit 4c75b5cc7d
2 changed files with 42 additions and 3 deletions
-1
View File
@@ -5,7 +5,6 @@ import EventEmitter from "events";
const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPreference=secondaryPreferred";
import { URL } from "url";
// TODO: auto throw error if findOne doesn't find anything
const url = new URL(uri.replace("mongodb://", "http://"));
const connection = mongoose.createConnection(uri, {