Reputation: 31
I want to run more than one query .. how to do it?
eg, I have below two queries -
FOR doc IN users
RETURN doc
FOR doc IN users
RETURN { user: doc, newAttribute: true }
If I have to run both queries I have to run them separately, is there a way to execute a script or I need to put a semicolon at the end like SQL and run it.
Can I use arangosh?
Upvotes: 3
Views: 890
Reputation: 51
You can use LET
to execute multiple sub-queries in a single queries:
LET firstUserResult = (
FOR doc IN users
RETURN doc
)
LET secondUserResult = (
FOR doc IN users
RETURN { user: doc, newAttribute: true }
)
RETURN { first: firstUserResult, second: secondUserResult }
Some notes here - you will need to add an additional RETURN
statement at the end of the query. This will definitely work for reads but you may run into issues when trying to write in multiple queries.
Upvotes: 4