Access external dataset in map?


#1

Hi ,

I want to access some external data set while processing data in a bucket,
For example , I have an IP library(much small than main bucket, only a few MB), I want to add some geo (matched from that IP lib ) information to each record (user clicks) while processing them, is there any good practice in doing this? I do not think insert these IP information to the same bucket and performing a JOIN via MR is a good way.


#2

Hello,

Different points to answer your question here… let’s start with the last comment.

I do not think insert these IP information to the same bucket and performing a JOIN via MR is a good way.
When you are creating a view (map/reduce) in Couchbase you cannot access another document from it. The map function is only executed on the current document. So you cannot do the “join” as you describe it.

It is not a problem to store all the JSON document in a single Bucket. Many projects are doing this. Most of the time people are using different buckets when they have security constraints, or when they store different types of data, for example you store JSON document and use views in one bucket, and store binary content in another bucket.

So you can without any issue store all your JSON document in a single bucket.

If you need more information do not hesitate to give some JSON document/Design sample

Regards
Tug
@tgrall