简体   繁体   English

在 Mongo-Atlas Stitch 中使用上下文时出错

[英]Error while using context in Mongo-Atlas Stitch

I'm trying to create a stitch for a Mongo-Atlas cluster.我正在尝试为 Mongo-Atlas 集群创建一个针迹。

Here is the simple webhook function这是简单的 webhook 函数

exports = function(payload) {
   const mongodb = context.services.get("mongodb-atlas");
   const cyber = mongodb.db("cyber"); 

};

unfortunately running this gives me the error不幸的是运行这给了我错误

TypeError: Cannot access member 'db' of undefined类型错误:无法访问未定义的成员“db”

trace: TypeError: Cannot access member 'db' of undefined at exports (function.js:4:18) at apply () at function_wrapper.js:3:10 at :12:1跟踪:类型错误:无法访问未定义的成员“db”在出口(function.js:4:18)在应用()在function_wrapper.js:3:10在:12:1

Basically the first get call returns mongodb as undefined .基本上,第一个 get 调用将mongodb返回为undefined

Anybody has run into this issue?有人遇到过这个问题吗?

Ok this was silly.好吧,这很愚蠢。

The context name for my cluster was not "mongodb-atlas" but rather "mongodb-atlas-production"我的集群的上下文名称不是"mongodb-atlas"而是"mongodb-atlas-production"

If you are at MongoDb-Atlas, u can try first reading the documentation appended in your function definition.如果您在 MongoDb-Atlas,您可以尝试先阅读附加在您的函数定义中的文档。

Functions run by Triggers are run as System users and have full access to Services, Functions, and MongoDB Data.触发器运行的函数以系统用户身份运行,并拥有对服务、函数和 MongoDB 数据的完全访问权限。 [...] Note: In Atlas Triggers, the service name is defaulted to the cluster name. [...]注意:在 Atlas Triggers 中,服务名称默认为集群名称。

It means that your SERVICE_NAME is the name of your Cluster .这意味着您的SERVICE_NAME是您的Cluster的名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Mongo-atlas连接:ReferenceError:未定义客户端 - Mongo-atlas connection : ReferenceError: client is not defined 连接 digitalocean 时出现 Mongo atlas 错误 - Mongo atlas error while connecting on digitalocean 连接到 mongo atlas uri 时出现 Mongo 网络错误 - Getting Mongo Network Error while connecting to mongo atlas uri 使用 MongoDB 针迹是否也会收取 MongoDB Atlas 的费用? - Does using MongoDB stitch also charges costs for MongoDB Atlas? 如何使用 Stitch 在 MongoDB Atlas 上执行“不同”的 MongoDB 查询 - How to perform a "Distinct" MongoDB query on MongoDB Atlas using Stitch 使用 ZCCADCDEDB567ABAE643E15DCF0974E503Z 连接到 MongoDB Atlas 时出错 - error while connecting to MongoDB Atlas using Mongoose 观察针迹中的文档时出现运输错误 - Getting transport error while watching the document in stitch 无法使用 Kubernetes 服务连接到 mongo atlas - Unable to connect to mongo atlas using Kubernetes service 在MongoDB Stitch App中使用AWS ESS服务时获取区域错误 - Getting region error while using aws ses service in mongodb stitch app 我正在尝试使用以下代码通过 postman 将一些数据发布到 mongo compass atlas 但收到此错误 - I'm trying to post some data through postman into mongo compass atlas using the following code but get this error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM