Browse Source

meta修改bug

lrf 5 months ago
parent
commit
87d8b4900a
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/frame/BaseService.ts

+ 2 - 1
src/frame/BaseService.ts

@@ -1,7 +1,7 @@
 import { ReturnModelType } from '@typegoose/typegoose';
 import { AnyParamConstructor } from '@typegoose/typegoose/lib/types';
 import { Application, Context } from '@midwayjs/koa';
-import { cloneDeep, get } from 'lodash';
+import { cloneDeep, get, omit } from 'lodash';
 import { PageOptions, ResultOptions } from './Options';
 import { PopulateOptions } from 'mongoose';
 import { App, Inject } from '@midwayjs/core';
@@ -97,6 +97,7 @@ export abstract class BaseService<T extends AnyParamConstructor<any>> {
     if (filterKeys.length <= 0) throw new ServiceError(ErrorCode.NEED_PARAMS);
     const num = await this.model.count(filter);
     if (num <= 0) throw new ServiceError(ErrorCode.DATA_NOT_FOUND);
+    body = omit(body, ['meta'])
     await this.model.updateMany(filter, body);
   }