diegogub / aranGO

Golang driver for ArangoDB
Apache License 2.0
125 stars 31 forks source link

Cannot create graph #52

Open omarghader opened 5 years ago

omarghader commented 5 years ago

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

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" })