Accessing external files from within couchbase veiw


#1

I know we can not access bucket from view’s map or reduce function.
Is it possible:

  1. To access external file (hdfs/NFS/local) from within couchbase views ? if yes how ?
  2. To access other DB (e.g. MySQL) from within couchbase view’s map/reduce function ?

Is there any other way to access external data (located anywhere) from view’s map/reduce function ?


#2

@kbaswaraj no, there is no way to access anything outside the scope of the function other than what gets passed in. There are a few technical reasons for that, like we need to make sure this code is compiled down in the V8 engine and we don’t have external drivers for different systems baked in. Also, you don’t know on which machine your map/reduce functions get executed, since every data node will perform its subset.

If you want to do something more involved, I recommend you to take a look at for example the Spark module where you can generate an RDD out of a view result and then you enrich the data with info from mysql, hdfs, nfs, and store it back into couchbase or do something else with it.