nodejs-datastore icon indicating copy to clipboard operation
nodejs-datastore copied to clipboard

Don't unwrap automatically for Number to Datastore Types

Open crwilcox opened this issue 3 years ago • 4 comments

Related to #754, #759

Remove auto inference of Numbers. This is a 'foot-gun' in the library and we should encourage usage of datastore.double and datastore.int so the library doesn't choose poorly.

This is for sure used in Save and Query today.

Note: breaking change.

crwilcox avatar Nov 18 '20 21:11 crwilcox

It would be nice to create a migration path for DB created before inference is removed.

In such DB there could be a mix of integer/float for the same property and datastore.double / datastore.int would only apply to numbers created after the inference is removed.

vicb avatar Nov 18 '20 22:11 vicb

Going to block on this happening for a bit. Warning may be enough and is in PR, tracked by 759.

crwilcox avatar Dec 08 '20 18:12 crwilcox

I am rewording this as the approach has moved from removal to changing the default behavior. By default we shouldn't unwrap these. Int and Double , as of the pr (773) extend Number. Keeping them wrapped should cause no/minimal friction, but allow us to still have additional data about the type in datastore.

crwilcox avatar Dec 12 '20 01:12 crwilcox

Reconsider the approach (back to removal) — added thenext major: breaking change label to ensure we don't miss it.

meredithslota avatar Nov 08 '23 03:11 meredithslota