Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: mongo Deciamal type #712

Open
zhaoyao91 opened this issue Sep 26, 2019 · 6 comments
Open

Feature: mongo Deciamal type #712

zhaoyao91 opened this issue Sep 26, 2019 · 6 comments

Comments

@zhaoyao91
Copy link

zhaoyao91 commented Sep 26, 2019

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?

@thearabbit
Copy link

+1

@thearabbit
Copy link

how about this?

1 similar comment
@thearabbit
Copy link

how about this?

@lukejagodzinski
Copy link
Member

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

@thearabbit
Copy link

thanks for your reply. sorry I have abit knowledge

@boomfly
Copy link

boomfly commented Aug 15, 2020

@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)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants