Comments (4)
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.
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.
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.
Issue created in the main Dgraph repo. Link
from dgraph-js.
Related Issues (20)
- Add tests for upsert with graphql variables
- Dgraph unique identifier HOT 1
- GRPC Error on many simultaneous connections HOT 6
- when running a mutation unable to get the response in JSON
- Can't run multiple mutations in same transaction HOT 1
- Module import requires unsafe-eval in script content security policy directive HOT 2
- RFC: enhancement over dgraph schema HOT 6
- GitHub issues are being deprecated. HOT 1
- Does Dgraph support Dgraph Module for Nestjs ? HOT 1
- too many request
- Simple example broken with dgraph-js 2.0.0 HOT 1
- Uncaught error - when ACL feature is turned on, and login credentials not passed HOT 2
- Getting error when running doRequest HOT 11
- Upsert should always return the uid HOT 3
- Mutate is not part of dgraph.API as of v1.1.0 HOT 1
- Upgrade google-protobuf dependency version to 3.8.0+
- TypeError: Cannot read property "serializeBinary" of undefined HOT 1
- Simple example throws error: "Missing colon in type declaration." HOT 6
- Documentation on pre-v7.6 examples should be removed HOT 2
- Update test cases to support multiple mutations HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dgraph-js.