Created
June 10, 2015 11:52
-
-
Save omegahm/389b00d3f547f21e7b76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(doc) { | |
doc.postal_districts.forEach(function(pd) { | |
pd.postal_codes.forEach(function(pc) { | |
emit(pc.postal_code, { | |
postal_name: pc.name, | |
postal_code: pc.postal_code, | |
type: pc.type, | |
postal_district_id: pd.id, | |
slug: pd.slug | |
}) | |
}); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(doc) { | |
pds = doc.postal_districts | |
for(i=0;i<pds.length;i++){ | |
pcs = pds[i].postal_codes | |
for(j=0;j<pcs.length;j++){ | |
data = { postal_name: pcs[j].postal_name, postal_code: pcs[j].postal_code, type: pcs[j].type, postal_district_id: pds[i].id} | |
emit(pcs[j].postal_code, data ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment