소스 검색

修改金额插件

lrf 2 년 전
부모
커밋
ba48a8199b
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      lib/model/type-money-plugin.js

+ 2 - 2
lib/model/type-money-plugin.js

@@ -1,9 +1,9 @@
 'use strict';
 const { Decimal128 } = require('mongoose').Types;
-module.exports = exports = params =>
+module.exports = exports = ({ key = 'money', ...params }) =>
   function metaPlugin(schema /* , options*/) {
     schema.add({
-      money: {
+      [key]: {
         type: Decimal128,
         set(data) {
           return data;