meteor-astronomy icon indicating copy to clipboard operation
meteor-astronomy copied to clipboard

Feature: mongo Deciamal type

Open zhaoyao91 opened this issue 4 years ago • 6 comments

To save monetary field, mongo 3.4 has supported NumberDecimal type, and meteor has its package mongo-decimal, which uses the npm package decimal.js, and SimpleSchema supports it by allowing you use Decimal as field type.

If/How Astronomy supports decimal?

zhaoyao91 avatar Sep 26 '19 06:09 zhaoyao91

+1

thearabbit avatar Jan 01 '20 03:01 thearabbit

how about this?

thearabbit avatar Jan 31 '20 11:01 thearabbit

how about this?

thearabbit avatar Jun 17 '20 14:06 thearabbit

I don't have time to implement it. If any one wants to help, feel free to create PR

lukejagodzinski avatar Jun 17 '20 17:06 lukejagodzinski

thanks for your reply. sorry I have abit knowledge

thearabbit avatar Jun 18 '20 00:06 thearabbit

@zhaoyao91, @thearabbit try this:

import { Type } from 'meteor/jagi:astronomy'

Type.create {
  name: 'Decimal'
  class: Decimal
  cast: (value) ->
    Decimal(value.toString())
  validate: (args) ->
    Decimal.isDecimal(args)
}

boomfly avatar Aug 15 '20 08:08 boomfly