LoopbackJS 3.x,如何启用删除所有匹配的实例



默认情况下,在环回删除中,所有匹配的实例都不会通过 REST API 公开。如何启用它?

我找不到任何对文档的引用,但我成功地测试了这一点。

TLDR:把它放在你的model.jsserver.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被注释掉了。

最新更新