【发布时间】:2017-06-20 15:13:28
【问题描述】:
我试图在 Collection 上触发触发器,但它似乎没有跳闸。触发器是使用 Azure 门户准备的。我正在尝试特定的逻辑 - 但最后只是在 Azure 站点上放置了一个示例。触发逻辑如下:
var context = getContext();
var request = context.getRequest();
// document to be created in the current operation
var documentToCreate = request.getBody();
// validate properties
if (!("timestamp" in documentToCreate))
{
var ts = new Date();
documentToCreate["my timestamp"] = ts.getTime();
}
// update the document that will be created
request.setBody(documentToCreate);
触发器不工作。似乎没有产生错误,我不确定发生了什么。
注意:触发器是一个 pre crate 触发器。对于我列出的触发逻辑,我没有创建具有“我的时间戳”属性的文档。我还根据相同的概念测试了其他场景,我想将属性添加到正在创建的文档中。
【问题讨论】:
标签: azure azure-cosmosdb