- It really use UTF-8
- It uses meaningless and uniform IDs
- All documents has type attribute
- The bigger dataset
- Geo attributes has names (lat, lng) instead of just two-element array
Map
function(doc, meta) {
switch(doc.type) {
case "brewery":
emit([meta.id]);
break;
case "beer":
emit([doc.brewery_id, meta.id]);
break;
}
}
Map
function (doc, meta) {
if (doc.country, doc.state, doc.city) {
emit([doc.country, doc.state, doc.city], 1);
} else if (doc.country, doc.state) {
emit([doc.country, doc.state], 1);
} else if (doc.country) {
emit([doc.country], 1);
}
}
Reduce
_count
Spatial
function(doc, meta) {
if (doc.geo) {
emit({type: "Point", coordinates: [doc.geo.lng, doc.geo.lat]}, [meta.id, doc.geo]);
}
}
The export.rb
script lives in script
directory. See instructions in
the file header.