Skip to content

dropAll working? #31

@labs20

Description

@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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions