如何将日期插入ArangoDB?

Sul*_*man 4 json d date arangodb vibed

我无法理解使用ArangoDB进行日期存储的格式.尝试以这种格式插入日期: {"name": "vasia", "date": date("2013-01-15")}

std.json.JSONException@C:\vibe-d-0.7.24\source\vibe\data\json.d(1116): (1): Error: Expected valid JSON token, got 'date("2013-0'.

看起来这个字符串上的振动JSON模块失败了,但使用Arango的格式是什么?

{"name":"vasia","date":"2013-01-15"}在DB中成功插入格式的字符串,但我无法理解它是作为文本还是作为Date对象插入?

小智 6

它是作为文本还是作为Date对象插入?

作为文本,因为ArangoDB仅支持JSON数据类型.JSON没有Date类型,因此日期通常编码为字符串.你如何做到这一点取决于你,但既然你正在使用D,我建议你使用Date.toISOExtString.对于其他一些选项,请参阅此问题.