/mutate reply is success with uids, but no data?


(J Czz) #1

I have this file(mutate_plat.txt):

{
“set”: [
{
“name”: “Ben”,
“age”: 31
},
{
“name”: “Ann”,
“age”: 28
},
{
“name”: “Chr”,
“age”: 28
}
]
}

And then post this:
`

curl -H “Content-Type: application/json” -X POST localhost:8080/mutate -d “@./mutate_play.txt” | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 589 100 365 100 224 17380 10666 --:–:-- --:–:-- --:–:-- 28047
{
“data”: {
“code”: “Success”,
“message”: “Done”,
“uids”: {
“dg.2743840233.60”: “0x43”,
“dg.2743840233.61”: “0x44”,
“dg.2743840233.62”: “0x45”
}
},
“extensions”: {
“server_latency”: {
“parsing_ns”: 49900,
“processing_ns”: 12167000
},
“txn”: {
“start_ts”: 24491,
“keys”: [
“1ewx0mkepfmaf”,
“1l0bl3js4vwl9”,
“1nyymst24gray”,
“1oisgt0qsylkr”,
“2qxr8ruc4ocub”,
“x1zrjunybf4s”
],
“preds”: [
“1-age”,
“1-name”
]
}
}
}

And this query file(query_play.txt):

{
people(func: has(name)) {
name
}
}

And not data - can you see what I am doing wrong?

curl -H “Content-Type: application/graphql±” -X POST localhost:8080/query -d “@/Users/christian/Development/tools/power/plates/dgraph/play/query_play.txt” | jq <

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 222 100 174 100 48 5272 1454 --:–:-- --:–:-- --:–:-- 6727
{
“data”: {
“people”:
},
“extensions”: {
“server_latency”: {
“parsing_ns”: 33000,
“processing_ns”: 14644000,
“encoding_ns”: 8600,
“assign_timestamp_ns”: 1669400
},
“txn”: {
“start_ts”: 24505
}
}
}


(Daniel Mai) #2

When calling /mutate via Curl you’ll need to explicitly commit the mutation. You can do that by calling /commit as described in the Raw HTTP API docs for /commit: https://docs.dgraph.io/clients/#committing-the-transaction.

You can also specify the query parameter /mutate?commitNow=true to commit that mutation immediately.