今天我遇到了一个问题,我无法确定删除操作是否在.vertical-center {
min-height: 100%; /* Fallback for browsers do NOT support vh unit */
min-height: 100vh; /* These two lines are counted as one */
display: flex;
align-items: center;
}
.row {
height: 100vh;
width:100%;
background-size: cover;
margin: 0;
padding: 0;
}
section .inside-row {
height: 100vh;
width:100%;
background-size: cover;
}
section img {
width: 40%;
margin: 0 auto;
display: flex;
align-items: center;
}
挂钩中成功完成。这是有问题的,因为它需要额外的数据库操作来确定删除是成功还是失败。
'after delete'
没有迹象表明操作是成功还是失败,并且无论操作是否成功,都会调用UserFollowers.observe('after delete', function observer(ctx, next) {
var instance = ctx.instance; // ctx.instance is null for some reason.
logger.info('Starting after delete');
logger.info('Ctx:',JSON.stringify(ctx));
// Ctx: {"where":{"followSrcId":2,"followDestId":1},"hookState":{},"options":{}}
logger.info('Ctx Non-Enumerable Properties:', Object.getOwnPropertyNames(ctx));
// Ctx Non-Enumerable Properties: ["Model","where","hookState","options"]
// Note that Model is the only non-enumerable property not spit out by JSON.stringify()
});
挂钩。 (在数据库中手动验证)
此外,确定操作是否成功的唯一方法是尝试选择之前存在的记录。
有没有办法得到这个?
答案 0 :(得分:1)
您可以设置ChangeStream,只要服务器上的模型发生更改,它就会发送事件。只有警告在DELETE上,即使没有与请求匹配的记录,操作成功时也会收到一个事件。因此,举例来说,如果我尝试使用name=foo
两次删除相同的记录,我会两次回复:
{"target":"foo","where":{"name":"foo"},"type":"remove"}
https://docs.strongloop.com/display/public/LB/Realtime+server-sent+events
编辑:您还可以通过内置REST API创建和访问更改流