jagi / meteor-astronomy

Model layer for Meteor
https://atmospherejs.com/jagi/astronomy
MIT License
604 stars 66 forks source link

Floating point number is saved as Number - both in code & MongoDb command #691

Open a4xrbj1 opened 5 years ago

a4xrbj1 commented 5 years ago

We have the same problem (as this one https://github.com/jagi/meteor-astronomy/issues/575), both within our code:

return Gedmatches.insert({ kit1, kit2, totalCm, created, notSharing: true });

and when using MongoDb insert directly:

db.gedmatches.insert({ kit1: 'SyVRzmvn4f', kit2: 'Syfq7mD3Nz', created: new Date(), updatedAt: new Date(), totalCm: 7.32, HIR: 1 })

In both cases it changes the field value to 7 in the doc instead of 7.32

There must be an easier way to allow floating point numbers!

_Originally posted by @a4xrbj1 in https://github.com/jagi/meteor-astronomy/issue_comments#issuecomment-437563068_

lukejagodzinski commented 5 years ago

It's rather unlikely to happen. Neither MongoDB nor Astronomy would do that as long as you're not doing something extra. Amount of info you've provided is not sufficient to tell.

On Sat, Nov 10, 2018, 7:50 AM Andreas West <notifications@github.com wrote:

We have the same problem (as this one #575 https://github.com/jagi/meteor-astronomy/issues/575), both within our code:

return Gedmatches.insert({ kit1, kit2, totalCm, created, notSharing: true });

and when using MongoDb insert directly:

db.gedmatches.insert({ kit1: 'SyVRzmvn4f', kit2: 'Syfq7mD3Nz', created: new Date(), updatedAt: new Date(), totalCm: 7.32, HIR: 1 })

In both cases it changes the field value to 7 in the doc instead of 7.32

There must be an easier way to allow floating point numbers!

Originally posted by @a4xrbj1 https://github.com/a4xrbj1 in https://github.com/jagi/meteor-astronomy/issue_comments#issuecomment-437563068 https://github.com/jagi/meteor-astronomy/issue_comments#issuecomment-437563068

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jagi/meteor-astronomy/issues/691, or mute the thread https://github.com/notifications/unsubscribe-auth/ABAKXU_2BmOwTMvv3ipYhEq6sQ5x3uxeks5utncugaJpZM4YX3DC .

a4xrbj1 commented 5 years ago

What info do you need?

The definition for this field is:

totalCm: { type: Number, optional: true, },

lukejagodzinski commented 5 years ago

You have to create reproduction repository. Without that it's hard to tell. When you will try to replicate this error on the smaller code base it will probably appear to be caused not by Astronomy but by something else