统一猫鼬更新查询

时间:2021-02-01 20:23:40

标签: mongoose updates

我有一个函数必须执行这 3 次更新:

await this.updateMany(
    { 'head.firstBody.path': pathRegex },
    { 'head.firstBody.path': destinationPath },
  );
await this.updateMany(
    { 'head.secondBody.path': pathRegex },
    { 'head.secondBody.path': destinationPath },
  );
await this.updateMany(
    { 'head.thirdBody.path': pathRegex },
    { 'head.thirdBody.path': destinationPath },
  );

有人知道通过单个查询来做到这一点的方法吗?

0 个答案:

没有答案