0

I'm really loving that RethinkDB has Geospatial out of the box.

My only issue I'm having is with adding Polygons.

The docs (https://www.rethinkdb.com/api/javascript/polygon/) says I can only insert my points as arguments. This is completely unrealistic and unusable because I don't know how many vertices my user will decide on their polygon. It would be great if I could throw it an array of vertices but I get the error:

Unhandled rejection ReqlDriverError: r.polygon takes at least 3 arguments, 1 provided.

The only thing I can think of doing is making 16 separate functions that take in the specified amount of vertices in an array.

Any ideas what I can do? Thank you!

Robert Laverty
  • 186
  • 2
  • 10

1 Answers1

1

You can use r.args to splice an array into a variadic function. So r.polygon(r.args(ARRAY_OF_POINTS)) should work.

mlucy
  • 5,249
  • 1
  • 17
  • 21