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