Giter Site home page Giter Site logo

Comments (4)

pawanrawal avatar pawanrawal commented on August 25, 2024

Could not reproduce this. Could you share a full example @tamethecomplex? Here is what I tried. I also noticed that you are not checking your errors.

package main

import (
	"context"
	"fmt"
	"log"
	"testing"

	"google.golang.org/grpc"

	"github.com/dgraph-io/dgraph/client"
	"github.com/dgraph-io/dgraph/protos/api"
	"github.com/dgraph-io/dgraph/x"
)

func TestList(t *testing.T) {
	d, err := grpc.Dial("localhost:9080", grpc.WithInsecure())
	if err != nil {
		log.Fatal(err)
	}

	c := client.NewDgraphClient(
		api.NewDgraphClient(d),
	)

	ctx := context.Background()
	x.Check(c.Alter(ctx, &api.Operation{DropAll: true}))
	x.Check(c.Alter(ctx, &api.Operation{Schema: `
		jurisdiction: [string] .
		id: string @index(exact) .
	`}))

	out := []byte(`{"id":"c3acc43c-c635-475d-8bed-7c3b4f2af37d","type":"concept","term":"myTerm1","jurisdiction":["jur1","jur2"],"definition":"myDef1","lastUpdate":"2018-01-30T11:19:34.150"}`)
	assigned, err := c.NewTxn().Mutate(context.Background(), &api.Mutation{SetJson: out, CommitNow: true})
	x.Check(err)
	uid := assigned.Uids["blank-0"]

	q := `
	{
		concepts(func:eq(id, "c3acc43c-c635-475d-8bed-7c3b4f2af37d")) {
			term
			definition
			jurisdiction
		}
	}
	`

	resp, err := c.NewTxn().Query(ctx, q)
	x.Check(err)
	fmt.Println(string(resp.Json))

	txn := c.NewTxn()
	_, err = txn.Mutate(context.Background(), &api.Mutation{
		DelNquads: []byte(`<` + uid + `> <jurisdiction> * .`),
	})
	x.Check(err)

	resp, err = txn.Query(ctx, q)
	x.Check(err)
	fmt.Println(string(resp.Json))

	_, err = txn.Mutate(context.Background(), &api.Mutation{
		SetNquads: []byte(`<` + uid + `> <jurisdiction> "jur3" .`),
	})
	x.Check(err)
	x.Check(txn.Commit(context.Background()))

	resp, err = c.NewTxn().Query(ctx, q)
	x.Check(err)
	fmt.Println(string(resp.Json))
}

from dgraph-js.

cyphercider avatar cyphercider commented on August 25, 2024

Hi @pawanrawal, sorry, that was an abbreviated code example just for illustration.

For a complete / easily runnable example, please see:
https://github.com/tamethecomplex/js_issue_repro/tree/master/dgraph-js/issue_21

Please let me know if the example doesn't work or if something isn't clear. Thanks!

from dgraph-js.

pawanrawal avatar pawanrawal commented on August 25, 2024

Thanks for the example @tamethecomplex. I can reproduce this issue but strangely it happens approximately 1/10 times. I am working on a fix though this issue belongs to the Dgraph server and not the dgraph-js client so I'd say create an issue there.

from dgraph-js.

gpahal avatar gpahal commented on August 25, 2024

Issue created in the main Dgraph repo. Link

from dgraph-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.