0

我目前正在使用 mongodb 作为我的 apollo 服务器的数据源。我正在使用以下代码建立从 Apollo Server 到 Mongo 的连接

const mongoose = require('mongoose')

module.exports.connection = async () => {
    try{
        await mongoose.connect(process.env.MONGO_DB_URL, {useNewUrlParser: true, useUnifiedTopology: true})
        console.log("Database connected successfully.");
    } catch(e)
    {
        console.log("Database connection failed.");
        console.log(error);
        throw error;
    }
}

我想替换此连接部分以连接到 Dgraph(Dgraph Tenant 并使用 jwt 授权)并使用 GQL Endpoint 来运行查询和突变。

4

0 回答 0