Hello everybody! I’m completely new to dgraph so I apologise for the newbie question.
Right now I’m trying to set up a dgraph database which communicates with the clients through nodejs. As such I’ve installed dgraph-js (GitHub - dgraph-io/dgraph-js: Official Dgraph JavaScript client)
I’ve managed to get it to query the database and edit it, but I’d also like to get schema information.
Within the ratel interface I can run:
schema(pred: [name]) {
type
index
}
Or just
schema {}
And I get the expected output. From my nodejs server I can run:
const res = await this.connection.newTxn().query(`query {
getData(func: regexp(name, /.*mic+.*/i)) {
name
}
}`);
const data = res.getJson();
And get the fetched result, but if I try:
const res = await this.connection.newTxn().query(`schema {}`);
const data = res.getJson();
I get an empty result. I suspect that I shouldn’t be using newTxn().query() but something else. Should it be a new dGraph.Operation()? Or maybe something else? Where can I see all the functions available to me? The readme on the dgraph-js only provides so much information…