diff --git a/src/core/server/config.ts b/src/core/server/config.ts index fd200db91..f82bb46b8 100644 --- a/src/core/server/config.ts +++ b/src/core/server/config.ts @@ -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", }, diff --git a/src/core/server/services/mongodb/index.ts b/src/core/server/services/mongodb/index.ts index efaf8bcba..03f4d21a6 100644 --- a/src/core/server/services/mongodb/index.ts +++ b/src/core/server/services/mongodb/index.ts @@ -8,7 +8,10 @@ import { Config } from "talk-server/config"; */ export async function createMongoDB(config: Config): Promise { // 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.