Skip to content

Instantly share code, notes, and snippets.

@cboden
Last active July 11, 2016 15:19
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 cboden/3f758a71d313a4727a43c8b25c35e81c to your computer and use it in GitHub Desktop.
Save cboden/3f758a71d313a4727a43c8b25c35e81c to your computer and use it in GitHub Desktop.
curl http://localhost:5984/mydb/aSpecificDocId
// Take properties from aSpecificDocId which are keys for the following query
curl http://localhost:5984/mydb/_all_docs?keys=["docIdA","docIdB","docIdC","docIdD","docIdE"]
// curl http://localhost:5984/mydb/_design/mydoc/_view/fetch?startkey=["aSpecificDocId","a"]&endkey=["aSpecificDocId","z"]&include_docs=true
{
map: function(doc) {
if ('thing' === doc.type) {
emit([doc._id, doc._id], doc);
emit([doc._id, 'a'], {_id: doc.a});
emit([doc._id, 'b'], {_id: doc.b});
emit([doc._id, 'c'], {_id: doc.c});
emit([doc._id, 'd'], {_id: doc.d});
emit([doc._id, 'e'], {_id: doc.e});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment