ArangoDB:Foxx 服务中的事务限制

ArangoDB: Transaction restrictions within Foxx service

我试图找到描述限制的文档,这些限制可以从 javascript Foxx 微服务中的事务 运行 中安全访问。我曾在某处读到(现在找不到),除了通过交易参数数组传递的内容外,您无法访问任何内容,并且您必须重新导入交易中使用的所有节点模块。我很好奇我可以安全地将什么传递到事务中——例如 ArangoDB 数据库对象本身(而不是或重新导入它),为什么存在这些限制,以及性能影响是什么(对象封送处理?)。在我对单节点服务器的测试中,似乎访问外部定义的变量确实有效,所以我假设这些限制与数据库的更复杂配置有关 server/cluster.

谢谢!

I had read somewhere (can't find it now) that you can't access anything except what is passed via the transaction parameters array

这适用于 UDF(用户定义函数),不适用于 Foxx 微服务。

我相信所有关于Foxx的注意事项都在手册中:

https://docs.arangodb.com/3.3/Manual/Foxx/

特别是:

  • "you should not rely on server-side state (other than the database itself) between different requests as there is no way of making sure consecutive requests will be handled in the same context."

  • "Because the JavaScript code is running inside the database ... all Foxx and ArangoDB APIs are purely synchronous and should be considered blocking."