fix: new mongo parser

This commit is contained in:
Wyatt Johnson
2018-07-13 16:33:00 -06:00
parent b6305bec16
commit 34ddd2ea0b
2 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -49,14 +49,14 @@ const config = convict({
mongodb: {
doc: "The MongoDB database to connect to.",
format: "mongo-uri",
default: "mongodb://localhost/talk",
default: "mongodb://127.0.0.1:27017/talk",
env: "MONGODB",
arg: "mongodb",
},
redis: {
doc: "The Redis database to connect to.",
format: "redis-uri",
default: "redis://localhost:6379",
default: "redis://127.0.0.1:6379",
env: "REDIS",
arg: "redis",
},
+4 -1
View File
@@ -8,7 +8,10 @@ import { Config } from "talk-server/config";
*/
export async function createMongoDB(config: Config): Promise<Db> {
// Connect and create a client for MongoDB.
const client = await MongoClient.connect(config.get("mongodb"));
const client = await MongoClient.connect(
config.get("mongodb"),
{ useNewUrlParser: true }
);
// Return the database handle, which defaults to the database name provided
// in the config connection string.