{"action":"created","issue":{"url":"https://api.github.com/repos/nolanlawson/pouchdb-find/issues/21","labels_url":"https://api.github.com/repos/nolanlawson/pouchdb-find/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/nolanlawson/pouchdb-find/issues/21/comments","events_url":"https://api.github.com/repos/nolanlawson/pouchdb-find/issues/21/events","html_url":"https://github.com/nolanlawson/pouchdb-find/issues/21","id":65404620,"number":21,"title":"Is there an equivalent of multiple emits?","user":{"login":"tmld","id":8371059,"avatar_url":"https://avatars.githubusercontent.com/u/8371059?v=3","gravatar_id":"","url":"https://api.github.com/users/tmld","html_url":"https://github.com/tmld","followers_url":"https://api.github.com/users/tmld/followers","following_url":"https://api.github.com/users/tmld/following{/other_user}","gists_url":"https://api.github.com/users/tmld/gists{/gist_id}","starred_url":"https://api.github.com/users/tmld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmld/subscriptions","organizations_url":"https://api.github.com/users/tmld/orgs","repos_url":"https://api.github.com/users/tmld/repos","events_url":"https://api.github.com/users/tmld/events{/privacy}","received_events_url":"https://api.github.com/users/tmld/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-03-31T09:10:34Z","updated_at":"2015-04-07T03:51:52Z","closed_at":null,"body":"Hi there,\r\n\r\nI had a play around and couldn't figure out how to achieve the equivalent of multiple emits using this plugin. Is there:\r\n    a) A way to emit multiple values per document when creating an index, or\r\n    b) A way to utilise existing PouchDB views when searching?\r\n\r\nI'd like to be able to filter based on array values within the documents. For example, below (using the PouchDB query api) I can emit values for each actor in a movie and use this to find movies staring a particular actor.\r\n\r\nIs there a way to achieve this using the pouchdb-find plugin?\r\n\r\n<pre><code>// Source Data\r\nvar movies = [\r\n  {\r\n    \"name\": \"The Godfather\",\r\n    \"stars\": [\r\n      \"Marlon Brando\",\r\n      \"Al Pacino\",\r\n      \"James Caan\"\r\n    ]\r\n  }, ...\r\n]\r\n\r\n// Design document with multiple emits\r\n{\r\n\t_id: '_design/stars',\r\n\tviews: {\r\n\t\t'stars': {\r\n\t\t\tmap: function (doc) {\r\n\t\t\t\tfor(var i = 0; i &lt; doc.stars.length; i++) {\r\n\t\t\t\t\temit(doc.stars[i]); \r\n\t\t\t\t}\r\n\t\t\t}.toString()\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// Query for stars (returns a result for \"The Godfather\")\r\ndb.query('stars', {key: 'Al Pacino', include_docs: true});\r\n</code></pre>"},"comment":{"url":"https://api.github.com/repos/nolanlawson/pouchdb-find/issues/comments/90349224","html_url":"https://github.com/nolanlawson/pouchdb-find/issues/21#issuecomment-90349224","issue_url":"https://api.github.com/repos/nolanlawson/pouchdb-find/issues/21","id":90349224,"user":{"login":"tmld","id":8371059,"avatar_url":"https://avatars.githubusercontent.com/u/8371059?v=3","gravatar_id":"","url":"https://api.github.com/users/tmld","html_url":"https://github.com/tmld","followers_url":"https://api.github.com/users/tmld/followers","following_url":"https://api.github.com/users/tmld/following{/other_user}","gists_url":"https://api.github.com/users/tmld/gists{/gist_id}","starred_url":"https://api.github.com/users/tmld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmld/subscriptions","organizations_url":"https://api.github.com/users/tmld/orgs","repos_url":"https://api.github.com/users/tmld/repos","events_url":"https://api.github.com/users/tmld/events{/privacy}","received_events_url":"https://api.github.com/users/tmld/received_events","type":"User","site_admin":false},"created_at":"2015-04-07T03:51:52Z","updated_at":"2015-04-07T03:51:52Z","body":"Great, thanks @nolanlawson."}}