If you search this forum, you will see a lot of old posts on this subject. Basically this feature does not exist, but it is probably not the best data model anyway for Dgraph.
If you have something like likes
or votes
, it is better to just count nodes than to try and do incrementing.
So you could have:
type Post {
likes: [User]
...
}
This model won’t allow a user to vote more than once, for example. Then, just count those nodes to get number of likes.
J
Note: Now that Firestore has the count()
directive, there is an argument to be made that you should not use incrementing there either in certain situations.