Delete geographic point in dynamodb

38 views Asked by At

I am using Geo Library for Amazon DynamoDB to use geopoints in my project, putting my geopoints with this module already works, but now I have problems deleting the points, according to the documentation when you want to delete a point you have to do this:

myGeoTableManager
  .deletePoint({
    RangeKeyValue: { S: "1234" },
    GeoPoint: {
      // An object specifying latitutde and longitude as plain numbers.
      latitude: 51.51,
      longitude: -0.13,
    },
    DeleteItemInput: {
      // Optional, any additional parameters to pass through.
      // TableName and Key are filled in for you
      // Example: Only delete if the point does not have a country name set
      ConditionExpression: "attribute_not_exists(country)",
    },
  })
  .then(() => {
    console.log("Done!");
  });

According to the documentation, the name of the table and its keys are filled automatically but I get an error that precisely those fields are missing

The hash key and range key are automatic when you put a geopoint, so I really don't know what values they are and I can't access them, how do I solve this?

1

There are 1 answers

0
Leeroy Hannigan On

The hash key and table name are added for you, if your config is correct. You can see it's implementation here

My concern is more to the fact that you're using a library which was forked from an archived library which has not been maintained on 10 years. Moreover, the package you are using hasn't been maintained in a number of years either, and still uses SDK V2. If your application is ever going to be used in production, I strongly advise seeking alternative solutions.