diegogub / aranGO

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

failed to relate: Unable to save document error #42

Open TobiEiss opened 7 years ago

TobiEiss commented 7 years ago

I cant persist a new entry into a edge-collection. The result of a debug-session: we get 404 from http-rest-arango-endpoint.

I get the same error with the "relate-example" (README).

diegogub commented 7 years ago

Hello @TobiEiss , I will check this. Thanks fro report. Which Arangodb version are you using? and wich aranGO version?

TobiEiss commented 7 years ago

@diegogub arango version 3.1.1

And i found the Problem:

A little (dirty) workaround: instead of (README-example):

// Relate documents
s.DB("test").Col("ed").Relate(d1.Id,d2.Id,map[string]interface{}{ "is" : "friend" })

use:

edge := map[string]interface{}{}
edge["is"] = d1.ID
edge["friend"] = d2.ID
err := s.DB("test").Col("ed").Save(edge)

AND change in collection.go (line 135) if col.Type == 2 || col.Type == 3 {

stefanwuthrich commented 7 years ago

I try'd this fix and get following :

session.go:129: -------------------------------------------------------------------------------- session.go:130: REQUEST session.go:131: -------------------------------------------------------------------------------- session.go:132:

session.go:133: Payload: session.go:134: { "friend": "docs1/196952", "is": "docs1/196948" } session.go:170: -------------------------------------------------------------------------------- session.go:171: RESPONSE session.go:172: -------------------------------------------------------------------------------- session.go:173: Status: 400 session.go:174: Header: session.go:175: { "Connection": [ "Keep-Alive" ], "Content-Length": [ "81" ], "Content-Type": [ "application/json; charset=utf-8" ], "Server": [ "ArangoDB" ] } session.go:176: Body: session.go:180: { "error": true, "errorMessage": "invalid edge attribute", "code": 400, "errorNum": 1233 } (newest arangodb version, with master and v2 branch of aranGO)

TobiEiss commented 7 years ago

Ah, okay. My workaround is for master-branch

stefanwuthrich commented 7 years ago

for me it did not work on master and v2 branch