Comments (5)
To be honest, I also don't really understand why the ArangoDB team never implemented some kind of delete cascade.
The remove vertex operation from the graph management interface is Javascript so I would not consider it as a viable option in a Go program (but I did it with the transactions so why not...).
The Javascript API is still way ahead of AQL (for example the transactions that can only be done using Javascript right now) but they are working hard on implementing everything natively for AQL and ArangoDB 3.0 should be a great step towards that.
from arangolite.
Yea, it feels really incomplete right now when AQL doesn't have the same capability as the JS interface.
I think I should get the edge first somehow to get the key, then do a Send
to DELETE /_api/edge/{col}/{key}
.
Thought?
from arangolite.
Actually, the best solution I found for now is using the AQL traversals like that:
t := arangolite.NewTransaction(
nil,
[]string{"users","dashboards","dashboardRights","devices","deviceRights"},
).AddQuery("users", `
FOR u IN users
REMOVE u IN users
RETURN u
`).AddQuery("", `
FOR u IN {{.users}}
FOR v,e IN OUTBOUND u dashboardRights, deviceRights
REMOVE v IN dashboards OPTIONS { ignoreErrors: true }
REMOVE e IN dashboardRights OPTIONS { ignoreErrors: true }
REMOVE v IN devices OPTIONS { ignoreErrors: true }
REMOVE e IN deviceRights OPTIONS { ignoreErrors: true }
`).Return("users")
The thing which is not cool is that we have to statically indicate the collection in which we want to remove a vertex/edge. So here we have basically to try every possibility. Still not very beautiful haha.
from arangolite.
Seems complicated for a task so simple.
I think I need to learn AQL more to totally understand what's going on in that query.
from arangolite.
Yeah I know and I totally agree with you. There should be some simple way to cascade when there's a deletion...
from arangolite.
Related Issues (17)
- Basic example error HOT 5
- Support cursors without goroutines HOT 3
- Add support for jwt HOT 1
- Requests produce no result HOT 3
- Unmarshalling Result Has Duplicate Methods HOT 1
- Accessing error code from returned error HOT 2
- database.Run() response result (parsedResponse.Result) always empty HOT 3
- Quote in json value breaks the queries HOT 3
- bulk import API
- Make db fields public HOT 4
- Support 3.x
- Possibility to get []byte instead of umarshaled struct as result HOT 2
- can connect multiple coordinator, and polling to send requests? HOT 1
- Prevent AQL injection in transaction HOT 1
- Adding new commands HOT 9
- Allow for extension of the library with change to Runnable HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arangolite.