Basic Schema, Data and Query Problem

There’s something I’m not understanding. I created the following simple Schema.

type Asset {
asset_id: string
name: string
}

asset_id: string @index(exact) .
name: string .

I added a single node using the following JSON.

{
“set”: [
{
“uid”: “_:asset1”,
“asset_id”: “4b54f417-440f-4db7-b224-e0f46a04baf9”,
“dgraph.type”: “Asset”,
“name”: “fox.jpg”
}
]
}

When I do the following query, I get no nodes back. I’m puzzled!

{
find_asset(func: eq(asset_id., “4b54f417-440f-4db7-b224-e0f46a04baf9”)) {
uid
asset_id.
name
}
}

Can someone see what I might be doing wrong?

Thanks,
Michael-

That’s why you’re using a “dot” at the end of your pred. In your schema, there’s no “dot”.

Thanks Michel. But that wasn’t my problem. I had tried this several times. With and without the ‘.’. I was running my requests from Postman. I looked at what the tutorial was doing and found that when I was setting the data using mutate, I did not include the query parameter “commitNow=true”.

Once I did that it works!
Michael-

But pay attention, if you put the “dot” It won’t work anyway.