How do I use a syntax like select *

{
	node(func: uid(0x37b)) {
		uid
	 expand(_all_)
	}
}
  • The exception’s query statement did not query all of the fields

  • See the return result below

{
  "data": {
    "node": [
      {
        "uid": "0x37b"
      }
    ]
  }
}

Result only uID, not the result I want, how to use expand(all) syntax properly like mysql SELECT *

Could you share the data that you’ve loaded into the database?

98% chance that you have not defined your Type Schema and dgraph.type in your dataset.
See https://dgraph.io/docs/query-language/type-system/

Also, test if there is anything in that node. e.g.

{
	node(func: uid(0x37b)) {
	    uid
	    myPredicate1
	    myPredicate2
	    myPredicate3
	}
}
{
    "set": [
        {
            "follows": {
                "name": "MICHAELS_UID",
                "age": 20
  							
            },
            "name": "LEYLAS_UID",
            "age": 10
        }
    ]
}

this is the original statement

{
    "set": [
        {
            "follows": {
                "name": "MICHAELS_UID",
                "age": 20
  							
            },
            "name": "LEYLAS_UID",
            "age": 10
        }
    ]
}

In my opinion, your issue is 99,99%* related to the lack of the type definition.

Fix your mutation

{
   "set": [
      {
         "follows": {
            "dgraph.type": "Person",
            "name": "MICHAELS_UID",
            "age": 20
         },
         "dgraph.type": "Person",
         "name": "LEYLAS_UID",
         "age": 10
      }
   ]
}

And add “Person” type on your Schema definition.


Executing the statement you issued and requerying it will not automatically find the other fields

I’m not sure what you mean. You have to start from scratch or update those nodes.

The Type System is a combination of the Type Definition in the Schema and marking up the dgraph.type itself on each node.

The best you can do is start from scratch and you are good to go.

If a type has a hundred or even a thousand fields, I have to write every field in the query, but sometimes this is inconvenient. I need something like mysql select *, where I can find all the fields without having to write them in the query

To be clear, I don’t know how to use expand(all), it feels like expand(all) doesn’t make any sense, the actual test doesn’t feel like it will solve my problem

To be clear, I don’t know how to use expand(all), it feels like expand(all) doesn’t make any sense, the actual test doesn’t feel like it will solve my problem

expand(_all_)(and other functions) will work if you have a well defined Type Definition on your schema and also have the correct predicate value in the dgraph.type.