Selectively updating and deleting facets

Moved from GitHub dgraph/4787

Posted by hackintoshrao:

What version of Dgraph are you using?

Dgraph v1.1

Have you tried reproducing the issue with the latest release?

Yes

What is the hardware spec (RAM, OS)?

NA

Steps to reproduce the issue (command/config used to run Dgraph).

Create multiple facets for the same predicate and try to selectively update or delete one of them.

Expected behaviour and actual result.

Currently, when you have multiple facets for a given predicate, it’s not possible to write one query to selectively edit or delete one of them.
The way around is to read all the facets for a given predicate into memory, selectively edit them, and write all of them back.

If we are giving people the freedom to have multiple facets, not able to able to selectively update or delete them in one query is kind of counter-intuitive.
If this is not something we would want to support, we should at least document this behaviour and have more examples around it.

MichelDiz commented :

There are some issues that cover this in some ways
https://github.com/dgraph-io/dgraph/issues/1996
https://github.com/dgraph-io/dgraph/issues/4520

In the issue 1996 I shared some ideas about doing it with upsert block too. But the idea is a bit different from the issue itself. Cuz I promote it by doing Upsert Block instead of a new feature to the parser.

Supporting value variables in Facets with Upsert is a huge step to give support to this.

ChStark commented :

I made a syntax proposal on #4520 @hackintoshrao , can you share your thoughs ?