JSON mutation request to set edge facets

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
    }
  }
}

Please find the relevant documentation here: Facets and Edge attributes - Query language

1 Like

Thank you @harshil_goel But the given page gives an example of adding facets as triples not json. I want the same action JSON format. I am not sure how we can provide facets in JSON request

FYI : Asked in the document category as well

it was a minor thing actually. worked using the below mutation/query

Mutation to add transaction properties

{
  "set": [
    {
      "uid": "0x17",
      "accountNumber": "110011",
      "dgraph.type": "Account",
      "transactions": [
  			{
 					"uid": "0x18",
  				"transactions|amount" : 1000
        },
        {
          "uid": "0x19",
          "transactions|amount" : 100
        }
      ]
    },
    {
      "uid": "0x18",
      "accountNumber": "110012",
      "dgraph.type": "Account",
      "transactions": [
        {
          "uid": "0x19",
      "transactions|amount" : 10
        },
        {
          "uid": "0x1a",
          "transactions|amount" : 1000
        },
        {
          "uid": "0x1b",
          "transactions|amount" : 10
        },
        {
          "uid": "0x1c",
          "transactions|amount" : 10
        },
        {
          "uid": "0x1d",
          "transactions|amount" : 10
        }
      ]
    },
    {
      "uid": "0x19",
      "accountNumber": "110013",
      "dgraph.type": "Account",
      "transactions": [
        {
          "uid": "0x1d",
      "transactions|amount" : 10
        },
        {
          "uid": "0x1a",
          "transactions|amount" : 10
        }
      ]
    },
    {
      "uid": "0x1a",
      "accountNumber": "110014",
      "dgraph.type": "Account",
      "transactions": [
        {
          "uid": "0x1c",
      "transactions|amount" : 10
        }
      ]
    },
    {
      "uid": "0x1b",
      "accountNumber": "110015",
      "dgraph.type": "Account"
    },
    {
      "uid": "0x1c",
      "accountNumber": "110016",
      "dgraph.type": "Account"
    },
    {
      "uid": "0x1d",
      "accountNumber": "110017",
      "dgraph.type": "Account",
      "transactions": [
        {
          "uid": "0x1a",
      "transactions|amount" : 1000
        }
      ]
    }
  ]
}

Query to fetch transaction/edge properties as well

{
          find_transaction(func: eq(accountNumber, "110011")) @recurse(depth: 20, loop: true) {
            uid
            transactions @facets(amount)
    
          }
        }