Relative Content

Tag Archive for node.jsdatabasemongodbredisinfinite-scroll

Infinite scrolling sorted by likes

When the user visits a page, he gets the first 10 most liked comments, so now he’s watching the comments, in the meantime the 14th comment started getting more likes and now it’s the 8th most liked comment (the user doesn’t see it because he sees the 10 most liked comments when he fetched the page, which is ok) but now he starts scrolling and he gets more liked comments, skipping the first 10, but now the 8th comments is the 12th most liked comment in the db so he gets it again! And the 14th most liked is now the 8th so he’ll never get it.. I can’t figure out how to make it im using nodejs and mongodb and i want to make infinite scrolling of comments based on likes without duplicates or inconsistency and i can’t figure it out, I also wanna use redis for cache