Skip to content

Instantly share code, notes, and snippets.

@naotone
Created February 12, 2021 00:51
Show Gist options
  • Save naotone/07b2581cd629903131a9d244c73c5dc3 to your computer and use it in GitHub Desktop.
Save naotone/07b2581cd629903131a9d244c73c5dc3 to your computer and use it in GitHub Desktop.
Fauna: Add serial num id to collection
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