Assuming I am creating a geospatial line object with the same syntax as described in the documentation
r.table('geo').insert({
id: 101,
route: r.line([-122.423246,37.779388], [-121.886420,37.329898])
}).run(conn, callback);
Is there a way of appending a point to this line without using an atomic (read/write) pattern
If you already inserted the document into the database and want to add a point to that document, you can use the
udpate
command with thetoGeojson
command in order to do that.Here's how that would look:
Basically, I'm creating a new line in the
route
property. I'm passing it all the old points as an array and then appending a new tuple with the longitude and latitude.If you still haven't inserted the document into the database and wanted to add a point to that line, you could just do this: