Skip to content

Instantly share code, notes, and snippets.

@RichardLitt
Created July 16, 2015 13:10
Show Gist options
  • Select an option

  • Save RichardLitt/6c3ce03cc6824ce00568 to your computer and use it in GitHub Desktop.

Select an option

Save RichardLitt/6c3ce03cc6824ce00568 to your computer and use it in GitHub Desktop.
Key not working?
module.exports.getConversationPosts = exports.getConversationPosts = function getConversationPosts (conversation, cb) {
return db.query(function (doc) {
if (doc.conversation && doc.type && doc.type === 'note') {
emit(doc.conversation)
}
}, {include_docs: true, key: conversation.id}).then(function (response) {
// TODO This shouldn't be needed, the query should be doing this for us.
// Actually, this isn't working at all. The conversation.id is undefined.
console.log('conversation', response, conversation.id)
return _.filter(justTheDocs(response), function (doc) {
return doc.conversation === conversation.id
})
}).catch(function (err) {
return err
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment