Moved from GitHub dgraph-js/31
Posted by labs20:
Hi! I’m new on board and trying DGraph for the first time. Really excited about it, must say! =]
I have the code below, but when I call resetDgraph, my data is still there. What I’m doing wrong here?
__getDGraph(){
const dgraph = require('dgraph-js')
, grpc = require('grpc')
, clientStub = new dgraph.DgraphClientStub()
, client = new dgraph.DgraphClient(clientStub)
;
return {
client: client,
dgraph: dgraph
};
}
async resetDgraph(){
try{
let db = this.__getDGraph()
, op = new db.dgraph.Operation()
;
op.setDropAll(true);
let r = await db.client.alter(op);
// Retorna
return {
ok: r
}
} catch(e){
log.erro(e, '');
}
}
Thanks, and kudos for the work.