Live Loader - Node not creating as expected

What I want to do

I have a GraphQL schema, with a node type for “Country”, defined as:

type Country {
    country_code: String! @id @search(by: [exact])
    country_name: String @search(by: [exact])
}

I loaded a handful of Nodes successfully using a curl mutation, and now wanted to test adding a new node using Live Loader just to verify that my .json file format is correct.

What I did

I ran Live Loader from my leader Alpha nodes as:

dgraph live \ --files /data/1/data/dgraph/sample-data/json/countries1.json \ --alpha localhost:9080 \ --zero <zeroIP>:5080 \ --format json \ --cwd /data/1/data/dgraph \ --log_dir

My initial .json file looked like this:

[
  {"country_code":"MEX","country_name":"Mexico"}
]

The output of the Live command was:

Running transaction with dgraph endpoint: localhost:9080
Found 1 data file(s) to process
Processing data file "/data/1/data/dgraph/sample-data/json/countries1.json"
Number of TXs run            : 1                                                                    
Number of N-Quads processed  : 2
Time spent                   : 8.392862ms
N-Quads processed per second : 2

That seemed to indicate to me that the node created correctly.

Since I have country_code defined as an xid, I’m expecting that the internal uid will be created automatically.

I then use graphiQL to query the data:

query MyQuery {
	queryCountry {
  	country_code 
  	country_name
 }
}

The query returns, but it only shows the previous nodes created via curl.

Then I realized that I needed to specify the Node type. So, I updated my .json file to:

[
  {"dgraph.type":"Country", "country_code":"MEX", "country_name":"Mexico"}
]

I ran Live Loader again, with the result:

Running transaction with dgraph endpoint: localhost:9080
Found 1 data file(s) to process
Processing data file "/data/1/data/dgraph/sample-data/json/countries1.json"
Number of TXs run            : 1                                                                    
Number of N-Quads processed  : 3
Time spent                   : 9.457945ms
N-Quads processed per second : 3

Now, when I try running my query again, I get the result:

{
  "errors": [
    {
      "message": "Non-nullable field 'country_code' (type String!) was not present in result from Dgraph.  GraphQL error propagation triggered.",
      "path": [
        "queryCountry",
        7,
        "country_code"
      ]
    }
  ],
  "data": {
    "queryCountry": [
      {
        "country_code": "BRA",
        "country_name": "Brazil"
      },
      {
        "country_code": "IT",
        "country_name": "Italy"
      },
      {
        "country_code": "ISR",
        "country_name": "Israel"
      },
      {
        "country_code": "CAN",
        "country_name": "Canada"
      },
      {
        "country_code": "AUS",
        "country_name": "Australia"
      },
      {
        "country_code": "FRA",
        "country_name": "France"
      },
      {
        "country_code": "UK",
        "country_name": "United Kingdom"
      },
      null
    ]
  }
}

I dropped all of the data to remove any bad data from previous attempts, re-loaded the Country nodes again via curl, tried the Live command again, but still get the non-nullable field error.

By the way, when I try to specify the --schema flag on the Live command, I receive an error about the ‘@’ character - "Expected new line after field declaration. Got @"

What am I doing wrong here?

Thanks in advance!

Dgraph metadata

dgraph version

Dgraph version : v21.03.1
Dgraph codename : rocket-1
Dgraph SHA-256 : a00b73d583a720aa787171e43b4cb4dbbf75b38e522f66c9943ab2f0263007fe
Commit SHA-1 : ea1cb5f35
Commit timestamp : 2021-06-17 20:38:11 +0530
Branch : HEAD
Go version : go1.16.2
jemalloc enabled : true

Figured it out. The predicate names need to prefaced with the object type, such as: