Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Cannot create graph #52

@omarghader

Description

@omarghader

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions