Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create graph #52

Open
omarghader opened this issue Mar 15, 2019 · 0 comments
Open

Cannot create graph #52

omarghader opened this issue Mar 15, 2019 · 0 comments

Comments

@omarghader
Copy link

I am trying to create a graph but have some problems. I set log to true and got these error

  • The first error : orrrorphanCollections should be an array.
    • I fixed it by defineng orphanCollections to an empty array []string{}
  • The second error : cannot use _key
    • I fixed it by adding "omitempty" to key

My code is like following

    //Connect(host, user, password string, log bool) (*Session, error) {
   s,err := ara.Connect("http://localhost:8529","root","root",true) 
   s.CreateDB("test",nil)
   docs1 := NewCollectionOptions("docs1",true)
   s.DB("test").CreateCollection(docs1)
   
  var d1,d2 DocTest
  d1.Name = "Diego"
  d1.Age = 22
  d1.Likes = []string { "arangodb", "golang", "linux" }
  
  d2.Name = "Facundo"
  d2.Age = 25
  d2.Likes = []string { "php", "linux", "python" }

  err =s.DB("test").Col("docs1").Save(&d1)
  err =s.DB("test").Col("docs1").Save(&d2)
  if err != nil {
    panic(err)
  }

  // could also check error in document
 
  // update document
  d1.Age = 23
  err =s.DB("test").Col("docs1").Replace(d1.Key,d1)
  if err != nil {
    panic(err)
  }

  // Relate documents
  s.DB("test").Col("ed").Relate(d1.Id,d2.Id,map[string]interface{}{ "is" : "friend" })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant