Appery.io and MongoDB use of database functions to search based on geometry...
I'm creating a golf app that requires the ability to find courses within a geometry and then once in that course (geometry) - be able to use that geometry to find geo-points that app has in the DB within again -a radius.
I've looked through the Mongo db documentation and it supports 2d indexes on a geocoded field - and then there are query statements that can be used to find points in the DB that are within a radius that is passed via the geometry query.
I've loaded the geometry data into my data table for golf courses as a test,(into a geo field per Mongo spec) and used the database UI in appery.io to create an index on that field. I presume that's not sufficent. See below.
I've then tried though the appery builder to query the field when on the 'test' portion of request ( and I've added the appropriate fields to the header to create the request ). When I query the DB with the appropriate query I get a database error 1785 returned to me.
Question:
Can I use the mongodb attached to the appery application and related queries native in the db to query my geo data like the DB documentation suggests? The tutorial in the app suggests - by the fact that it's there - that this is generally not possible as it uses a function on the server to do this work - which I assume is NOT as efficient and potentially extra work - since there are nativeDB functions to do this work? Set me straight though on the best way to get geopoints with a radius where the data is loaded appropriately in the DB. ( query pipeline I'm using - { $geoNear: { } } )
Any help and advice would be greatly appreciated - as this time of code - will form the foundation of my application - and I'd like to do it as efficiently as follows with the best possible solution architecture....
Bruce