From 065346e7ef3e5e9c4f50af976a504a6e307a9efc Mon Sep 17 00:00:00 2001 From: Aurelsicoko Date: Tue, 6 Feb 2018 15:10:14 +0100 Subject: [PATCH] Remove trivial decimal implementation and use float type instead #550 --- packages/strapi-mongoose/lib/utils/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/strapi-mongoose/lib/utils/index.js b/packages/strapi-mongoose/lib/utils/index.js index 6820e8d014..a915585f3d 100755 --- a/packages/strapi-mongoose/lib/utils/index.js +++ b/packages/strapi-mongoose/lib/utils/index.js @@ -9,9 +9,12 @@ module.exports = mongoose => { const SchemaTypes = mongoose.Schema.Types; - SchemaTypes.Decimal.prototype.cast = function (value) { - return value.toString(); - }; + // Note: The decimal format isn't well supported by MongoDB. + // It's recommended to use Float or Number type instead. + // + // SchemaTypes.Decimal.prototype.cast = function (value) { + // return value.toString(); + // }; return { convertType: mongooseType => { @@ -25,9 +28,8 @@ module.exports = mongoose => { case 'biginteger': return 'Number'; case 'float': - return 'Float'; case 'decimal': - return 'Decimal'; + return 'Float'; case 'date': case 'time': case 'datetime':