zebra-lucky / meteor-aggregate-retyped

Meteor Mongo.Collection aggRetyped aggregate method
MIT License
1 stars 1 forks source link

Request to convert `Meteor/Number - DecimalJS` options #3

Closed thearabbit closed 5 years ago

thearabbit commented 5 years ago

I would like to request you the Meteor/Number - DecimalJS options

Ex:

let doc = {
  amount : 123.456
}

doc = replaceTypes(doc, replaceMeteorAtomWithDecimalJS)

And support on Client Code

zebra-lucky commented 5 years ago

What do you mean by "support on Client Code"?

thearabbit commented 5 years ago

Can use it on Client code

// client code
import {replaceType, ....} from .....
.............

let doc = {
  amount : 123.456
}

doc = replaceTypes(doc, replaceMeteorAtomWithDecimalJS)
Meteor.call('methodName', doc, (error, result)=>{
  .............
})
thearabbit commented 5 years ago

Could all of retype

zebra-lucky commented 5 years ago

Minimongo on client does not know about Mongo.Decimal128 type

thearabbit commented 5 years ago

But I would like to convert normal document

let doc = {
  amount : 123.456
  amount2: 6543.21
}

doc = replaceTypes(doc, replaceNumberAtomWithDecimalJS)

Instead of

let doc = {
  amount : Decimal(123.456)
  amount2: Decimal(6543.21)
}
zebra-lucky commented 5 years ago

Ok, I will add replaceNumberWithDecimal, replaceDecimalWithNumber?

zebra-lucky commented 5 years ago

published version 0.0.4

thearabbit commented 5 years ago

Very thanks again.