Created
February 12, 2021 00:51
-
-
Save naotone/07b2581cd629903131a9d244c73c5dc3 to your computer and use it in GitHub Desktop.
Fauna: Add serial num id to collection
This file contains 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
Reduce( | |
Lambda((acc, value) => | |
Let( | |
{ | |
count: Add(Select("count", acc), 1), | |
update: Update(value, { data: { id: Var("count") } }) | |
}, | |
{ | |
count: Var("count") | |
} | |
) | |
), | |
{ count: 0 }, | |
Documents(Collection("applications")) //Target Collection | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment