Hi! In the documentation in noted, than one can put multiple queries in one block.
Can I put one normal (predicate) query and one for the schema in one block?
This did not worked on play.dgraph.io :
schema
{
predicate
type
}
{
query(func: has(name), first:10){
name
}
}
Cheers!
MichelDiz
(Michel Diz)
October 13, 2019, 10:00pm
2
Nope.
if res.Query != nil {
return res, item.Errorf("Schema block is not allowed with query block")
}
switch item.Typ {
case itemOpType:
if item.Val == "mutation" {
return res, item.Errorf("Mutation block no longer allowed.")
}
if item.Val == "schema" {
if res.Schema != nil {
return res, item.Errorf("Only one schema block allowed ")
}
if res.Query != nil {
return res, item.Errorf("Schema block is not allowed with query block")
}
if res.Schema, rerr = getSchema(it); rerr != nil {
return res, rerr
}
} else if item.Val == "fragment" {
// TODO(jchiu0): This is to be done in ParseSchema once it is ready.
fnode, rerr := getFragment(it)
if rerr != nil {
return res, rerr
}
Thank your for your answer.
Maybe it’s not a bad idea to put a note to the documentation here and here that this kind of combining schema and predicate queries is not possible.
Cheers!
MichelDiz
(Michel Diz)
October 13, 2019, 10:14pm
4
I agree, please fill up an issue for docs in Dgraph’s repo.