Wednesday, August 29, 2018

Building a Dating Site With Neo4j: Part 10


To see Part 9, go here! I am now to the point where I want to do model messaging. There are a couple of ways of doing it. The first one is the simplest:

A user node has a MESSAGED relationship to another user node, the message and the time are stored as properties on the relationship and that's it. It's really easy to understand, but there is a problem with this model. As time grows and our user starts to have more conversations with various people, their node will be full of these MESSAGED relationships. How do we know which ones are new? We would have to traverse them all, get their "when" property, sort all the messages by time, and then show the user the most recent ones. This will make our query slower and slower as we add more data, and we want to avoid that. So what do we do? We could try "dated" relationship types:



from DZone.com Feed https://ift.tt/2wlgKcb

No comments:

Post a Comment