Created
March 5, 2019 19:26
-
-
Save solisoft/b294dce463b053dd8e4c1f8f94b7f84b to your computer and use it in GitHub Desktop.
ArangoDB / AQL : reorder collection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LET docs = (FOR doc IN @@collection SORT doc._key RETURN doc) | |
FOR i IN (0..(LENGTH(docs) - 1)) | |
LET doc = docs[i] | |
UPDATE({ _key: doc._key, order: i }) IN @@collection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment