View using geospatial and non-geospatial keys with CouchDB

I use CouchDB and GeoCouch, and I'm trying to figure out if I can build a geospatial index and β€œquery” the database using the location and value from another field.

Data

{ "_id": "1", "profession": "medic", "location": [15.12, 30.22] } { "_id": "2", "profession": "secretary", "location": [15.12, 30.22] } { "_id": "3", "profession": "clown", "location": [27.12, 2.2] } 

Questions

Is there a way to fulfill the following queries on these documents:

  • Find all documents with job = "medic" near the location [15.12, 30.22] (more important)
  • List all the different professions near this place [15.12, 30.22] (plus)

If this is not possible, what are my options? I'm already thinking about switching to MongoDB, but I’d better decide differently.

Notes

  • Data changes quickly, new documents can be added, and many can be deleted.

References

Graphical search using geo-index using CouchDB

+4
source share

Source: https://habr.com/ru/post/1480800/


All Articles