Pulling in external content from within CouchDB view
Does CouchDB allow you to call an external web service from within the definition of your view? I开发者_JAVA百科 basically want to resolve a woeid (where on earth id) using Yahoo's API's and update a view accordingly.
No, you cannot. The reason is that view indexes need to be completely self-contained. Using any external source would require the view index to be recalculated upon every change of that external resource. (not even to mention that CouchDB has no way of knowing when an external change has occurred.)
For this same reason, you cannot use CommonJS modules in your map/reduce (view) functions, as the server would have no way of knowing what changes to any CommonJS modules (in any design document) would have any effect on a given view. The only solution would be to update the view every time a change is made to any design document, which nobody would ever want.
I would recommend you look into GeoCouch for utilizing positioning in your project.
精彩评论