Thanks in advance for help and apologies for the noob question. I can succesfully add a single task to my Tasks collection in the shell and via API with Tasks.create(). However, when I try to follow the advice in other threads on adding multiple tasks with Map/Lambda I get error messages for Map, Lamda, Create and Var saying ‘Unbound variable ‘map’’. Pic below. I have searched the docs, forum and asked ChatGPT+Claude for assistance but without success. Any assistance appreciated.
Map(
[
[‘First Task’, ‘Complete initial setup’],
[‘Second Task’, ‘Review documentation’],
[‘Third Task’, ‘Implement features’]
],
Lambda(
[‘name’, ‘detail’],
Create(
Collection(‘Tasks’),
{
data: {
name: Var(‘name’),
detail: Var(‘detail’)
}
}
)
)
)
Hi @Robert_Collett and welcome!
I can see you are using an old version of FQL (v4). Please see our documentation for how to get started with Fauna using the latest version (v10) of the query language: Home - Fauna Docs
The FQL v10 query you are looking for might look something like this:
[
["first", "foo"],
["second", "bar"],
["third", "qux"],
].map(task => {
let name = task[0]
let detail = task[1]
Tasks.create({ name: name, detail: detail })
})
FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date.
Fauna accounts created after August 21, 2024 must use FQL v10. These accounts will not be able to run FQL v4 queries or access the v4 Dashboard.
Thank you. I really appreciate the advise and pointing out I’ve been trying with the wrong FQL version. I have it working now.
1 Like
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.