Do Dgraph have any limitations over adding number of nodes?

(Prateek) #1

Unable to attach multiple edges to a node

What I am Trying,
Let’s say, I Need User with 4 categories
Like this
user1–> category1, category2, category3, category4

I am able to connect only 2 categories at a time.
When try to add more than 2 categories older category nodes gets removed.

so initially user1–> category1 ,category2

after adding category3 and category4

new structure is
user1–> category3, category4

1.Do Dgraph have any limitations over adding number of nodes?
2. Is there is anything special functionality we need to add to handle more than 2 nodes?

(Aman Mangal) #2

As long as the schema is set to list, this should work fine.

(Prateek) #3

So our schema looks like this

type user {
name: string +
category: [category]

type category {
cname: string
userId: string
biller: [biller]

name: string @index(exact) @lang .
cname: string @index(exact) @lang .
category: [uid] @count .

and that i use in mutation setQuery Looks like this

String query = "query {
user as var(func: eq(name, “+userName+”))

category as var(func:eq(name, “+userName+”))
category @filter(eq(cname,"+categoryName+")){
userId @filter(eq(userId,"+userName+")) }

and in mutation i try to do

String triples=" uid(user) <name> “”+userName+"" .\n" +
" uid(user) <dgraph.type> “user” .\n" +
" uid(user) <category> uid(category)"+
" uid(category) <cname> “”+categoryName+"" .\n"+
" uid(category) <dgraph.type> “category” .\n"+
" uid(category) <userId> “”+userName+"" .\n"+

what i am i missing or doing wrong?
Also can you please help me with the correct query and mutations in such case where i have to get to a neighbour node using the uid of the current node and if not present can set it as an neighbour to the current node.

(Michel Conrado) #4

Why you using the syntax like this? are you using upsert transaction?

(Prateek) #5

I am using below code

Transaction txn=dgraphClient.newTransaction();
DgraphProto.Mutation mu = DgraphProto.Mutation.newBuilder()

DgraphProto.Request request = DgraphProto.Request.newBuilder()


i am pretty new to dgraph can you please help me with correct way to go ahead ?
Can you please help me on this ?