Keeping a datetime between node interactions


(Toby Archer) #1

Hey gang, I’m building something ontop of DGraph to manage a ‘many to many’ follower relationship, what I’m trying to achieve is keeping track of a datetime field of when X has ‘followed’ Y. I can’t seem to think how to achieve this as many instances of X can follow many instances of Y.

The current schema I had before needing this requirement is as follows.

id: string @index(term) .
Following: [uid] @count @reverse .

type User {
	id: string
	Following: [uid]
}

type Channel {
	id: string
}

Is my only option to create another edge between a User and a Channel that has the predicated for followed_at?

Feeling a bit stupid here :sweat_smile:.


(Toby Archer) #2

Illustrative diagram of what I’m ultimately trying to achieve


(Toby Archer) #3

And the answer is… Facets!

Solved my issue by adding a facet on the edge between Users and Channels. :duck::bug: