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

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

Open a4xrbj1 opened this issue 7 years ago • 3 comments
trafficstars

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

a4xrbj1 avatar Nov 10 '18 06:11 a4xrbj1

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 <[email protected] 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 .

lukejagodzinski avatar Nov 10 '18 09:11 lukejagodzinski

What info do you need?

The definition for this field is:

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

a4xrbj1 avatar Nov 12 '18 05:11 a4xrbj1

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

lukejagodzinski avatar Nov 12 '18 09:11 lukejagodzinski