How would one implement a user sortable list?

For example, a todo list where users can use drag and drop to reorder items in their own lists.

What kind of schema should be used for best performance?

Does Dgraph provide any advantages for this use case?

Take a look on https://github.com/dgraph-io/graphoverflow

Drag and drop operations are an application feature (not Dgraph). With Dgraph you could create a node for each intem of the list and use sort functions in queries.

I would recommend reading these articles:

Blog Post: https://blog.dgraph.io/post/building-graphoverflow/
Blog Post2: https://blog.dgraph.io/post/sql-vs-dgraph/

Sorting: https://docs.dgraph.io/query-language/#sorting

On performance, hashing is the best indexing for this.

Indexing: https://docs.dgraph.io/query-language/#indexing

1 Like