Update: I altered the votes node of the database. It didn't seem to make sense the way I had it structured.
This is my database structure:
-threadsMeta
-posts
-postId
-votes
-threadId
-postId
-uid: "down" //or "up"
The comments in the below code, I think, describe the intended behavior versus the actual behavior.
getMyUpVotes(threadId: string, uid: string): Observable<any> {
//Get all the postId's for this thread
let myUpVotes = this.af.database.list(`threadsMeta/${threadId}/posts`)
.map(posts => {
//Put each postId into a Firebase query path along with the uid from the method's params
posts.forEach(post => {
this.af.database.object(`votes/${threadId}/${post.$key}/upVotes/${uid}`)
//Emit only upvotes from this user on this post
.filter(data => data.$value === true)
})
})
myUpVotes.subscribe(data => console.log(data)) //Undefined
return myUpVotes
}