默认情况下,在环回删除中,所有匹配的实例都不会通过 REST API 公开。如何启用它?
我找不到任何对文档的引用,但我成功地测试了这一点。
TLDR:把它放在你的model.js
或server.js
app.models.<model>.remoteMethod('destroyAll', {
description: 'Delete all matching records.',
accessType: 'WRITE',
accepts: [
{arg: 'where', type: 'object', description: 'filter.where object'},
{arg: 'options', type: 'object', http: 'optionsFromRequest'},
],
returns: {
arg: 'count',
type: 'object',
description: 'The number of instances deleted',
root: true,
},
http: {verb: 'del', path: '/'},
// shared: false,
});
以上只是来自源的远程方法声明,只是shared: false
被注释掉了。