Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-01-2020 07:11 PM
Hello, i'm learning neo4j and i have a problem for a school project
Thanks
This is a portion of my code but there is an error :
(node:3622) UnhandledPromiseRejectionWarning: Neo4jError: The transaction has been terminated. Retry your operation in a new transaction,
const createMultiplesCategories=(req,res)=>{
const {allMenus}=req.body
console.log(allMenus)
allMenus.forEach(menu => {
const session = driver.session()
const {name,color}=menu
session.writeTransaction(transaction=> {
return transaction.run(CREATE (n:CATEGORY{ name:'${name}', color: '${color}' })
);
})
session.close();
});
}
the request JSON(BODY)
{
"allMenus":[
{"name":"FISH","color":"bg-light-pink"},
{"name":"SALAD","color":"bg-light-green"},
{"name":"APPETIZERS","color":"bg-washed-red"},
{"name":"VEGETARIAN DISHES","color":"bg-light-red"},
{"name":"BEVERAGES","color":"bg-light-pink"},
{"name":"ICE CRAM","color":"bg-light-green"},
{"name":"HAMBURGER","color":"bg-washed-red"},
{"name":"PIZZA","color":"bg-light-red"}
}
All the sessions of the conference are now available online