Hello, I am just getting started and have a question.
I am looking to use Dgraph for asset management. Most of the data would be consistently typed, but some would not, because I support each user setting custom annotations.
This map can vary user to user, or even within the same user:
// User 1 annotates items this way
{
"value": 5
}
// User 2 uses it differently
{
"value": "different type",
"company name": {
"external id": 3,
"purchased by": "Sam"
}
}
Right now, we handle this using MySQL’s JSON type. It is important that I can efficiently query on this untyped data. How would I support this with Dgraph?
You can use Facets https://dgraph.io/docs/query-language/facets/ it is untyped. But you can’t query it directly. First you query the object and then, in the query body, query the facets.
I am not yet certain that could handle my use case, as the annotations can be pretty complicated. For example, from the docs it looks like facets do not support arrays.
Facet keys are strings and values can be string, bool, int, float and dateTime