Skip to content

Instantly share code, notes, and snippets.

@samlown
Created March 16, 2012 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samlown/2050446 to your computer and use it in GitHub Desktop.
Save samlown/2050446 to your computer and use it in GitHub Desktop.
CouchDB Payment design doc which suddenly stopped working to requests on designs != all
{
"_id": "_design/Payment",
"_rev": "13-0996651a32cb63639fe01edd01383eb9",
"language": "javascript",
"views": {
"all": {
"map": "function(doc) {\n if (doc['type'] == 'Payment') {\n emit(doc['_id'],1);\n }\n }"
},
"by_sequence": {
"map": " function(doc) {\n if ((doc['type'] == 'Payment') && (doc['sequence'] != null)) {\n emit(doc['sequence'], 1);\n }\n }\n",
"reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
},
"by_updated_at": {
"map": " function(doc) {\n if ((doc['type'] == 'Payment') && (doc['updated_at'] != null)) {\n emit(doc['updated_at'], 1);\n }\n }\n",
"reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
},
"by_state_and_created_at": {
"map": " function(doc) {\n if ((doc['type'] == 'Payment') && (doc['state'] != null) && (doc['created_at'] != null)) {\n emit([doc['state'], doc['created_at']], 1);\n }\n }\n",
"reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
},
"by_journey_id_and_created_at": {
"map": " function(doc) {\n if ((doc['type'] == 'Payment') && (doc['journey_id'] != null) && (doc['created_at'] != null)) {\n emit([doc['journey_id'], doc['created_at']], 1);\n }\n }\n",
"reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
},
"by_journey_id_and_sequence": {
"map": " function(doc) {\n if ((doc['type'] == 'Payment') && (doc['journey_id'] != null) && (doc['sequence'] != null)) {\n emit([doc['journey_id'], doc['sequence']], 1);\n }\n }\n",
"reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
},
"by_user_id_and_created_at": {
"map": " function(doc) {\n if ((doc['type'] == 'Payment') && (doc['user_id'] != null) && (doc['created_at'] != null)) {\n emit([doc['user_id'], doc['created_at']], 1);\n }\n }\n",
"reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
},
"by_client_id_and_created_at": {
"map": " function(doc) {\n if ((doc['type'] == 'Payment') && (doc['client_id'] != null) && (doc['created_at'] != null)) {\n emit([doc['client_id'], doc['created_at']], 1);\n }\n }\n",
"reduce": " function(key, values, rereduce) {\n return sum(values);\n }\n"
},
"by_code": {
"map": "\n function(d) {\n if (d['type'] == 'Payment' && d['code']) {\n emit(d['code'], 1);\n }\n }\n ",
"reduce": "function(k,v,r) { return sum(v); }"
}
},
"couchrest-hash": "b7725c00a68ca642f47f6a4b4a99a8f3"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment