How to create edge facets in JSON mutation request

could anyone please help me with JSON request for mutation along with adding edge facets.
example :

{
        "set": [
            {
                "uid": "0x17",
                "accountNumber": "110011",
                "dgraph.type": "Account",
                "transactions" : [
                  { 
                    "uid": "0x18",
                    "amount" : "1000"
                  }
		]
            },
            {
                "uid": "0x18",
                "accountNumber": "110012",
  		"dgraph.type": "Account"
            }
        ]
    }

I want amount to be a facet on transaction edge. so that I can request it using the below query

{
  find_transaction(func: eq(accountNumber, "110011")) {
    uid
    transactions @facets(amount){
			uid
    }
  }
}

Solved here

FYI , using facets in JSON format is documented at
https://dgraph.io/docs/dql/dql-syntax/json-mutation-format/

We will add a link to the facets doc page!

1 Like