diegogub / aranGO

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

Connecting to a database other than _system #36

Closed revmen closed 8 years ago

revmen commented 8 years ago

I was unable to find an answer to this anywhere in the documentation.

The Connect function connects to the default _system database and allows you to run queries on any database from there.

I would prefer to connect with a user that does not have access to _system and use a database other than _system. How do I specify which database to connect to?

If this is not possible, perhaps it should be. It seems dangerous to only allow users to connect who have _system access.

diegogub commented 8 years ago

Hi @revmen , I see your concern. Currently I'm building v2 branch. So I will change API to add Database option when connecting.

Update: I wont change the API, but found out the issue. For login in the driver as calling version endpoint on _system database. Now I've just left the available databases for current user, but its not working if user do not have _system access. I created a issue on that in arangodb repo so they can answer that, I think it the endpoint should return available databases even if user do not have _system database permission.

Thanks!

diegogub commented 8 years ago

HI @revmen , now in v2 branch you can set default DB to connect before connecting. Regards!

https://godoc.org/gopkg.in/diegogub/aranGO.v2#SetDefaultDB