FgForrest/evitaDB

Filter references without referenced objects (optionally)

Closed this issue · 1 comments

evitaDB supports eventual consistency - i.e. allows to have a reference to a not yet existing entity. This is due to the fact that evitaDB usually maintains a secondary index that is gradually updated according to changes in the primary database. This change propagation can't be done transactionally and there can be situations where entity A that references entity B is created first when B starts to exist in evitaDB and it is considered as all right situation.

But when the client queries the data, it usually doesn't want to consider the references to non-existent entities. Except for the situation when it does updates - then it needs to know about the existence of the reference to avoid sending unnecessary upsert mutations to the server.

evitaDB should support this scenario with a new requirement argument - let's call it io.evitadb.api.query.require.ManagedReferencesBehaviour#EXISTING, which would tell the evitaDB engine to filter out references to managed entities that do not yet exist in evitaDB.

This requirement must also handle situations where the target managed entity exists but doesn't satisfy the constraints. For example, the client reads the entity in a particular locale, and the referenced entity doesn't have that locale and therefore can't be returned.

We will not propagate this requirement to GraphQL API because it's adept for the directives which needs to be researched in different issue: #474