dynamodb-geo.js icon indicating copy to clipboard operation
dynamodb-geo.js copied to clipboard

Compatible with DAX?

Open igorescobar opened this issue 6 years ago • 3 comments

Hi,

Is this library somehow compatible with DAX? I think that reason that it doesn't work for us is because of #14 .

Does anyone managed to make it work with: https://www.npmjs.com/package/amazon-dax-client or Any DAX client?

igorescobar avatar Sep 03 '18 16:09 igorescobar

@rh389 I managed to make the query to be compatible with DocumentClient(). You can see the change here: https://github.com/rh389/dynamodb-geo.js/compare/master...igorescobar:master

Not sure if it helps at all but I think it can be useful if someone ever needs to make it work with DocumentClient (required by DynamoDB DAX).

igorescobar avatar Sep 04 '18 17:09 igorescobar

Hi @igorescobar. Thanks for this - looks like a good start and should be backwards compatible. Do you want to make a PR out of it?

robhogan avatar Sep 04 '18 17:09 robhogan

One thing to watch out for - casting to Number will lose precision because javascript's Number can't store a full S2 cell ID (hence the use of long in this library) - in practice Number typically rounds the last three digits of a cell ID to 0. DynamoDB's numbers internally support 38 digits via string representation so they are safe, but we need to be careful not to lose precision on the client side.

robhogan avatar Sep 04 '18 17:09 robhogan