Created
July 16, 2015 13:10
-
-
Save RichardLitt/6c3ce03cc6824ce00568 to your computer and use it in GitHub Desktop.
Key not working?
This file contains hidden or 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
| 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