简体   繁体   English

查询ArangoDB 3.1中的日期

[英]Querying dates in ArangoDB 3.1

As I understood, ArangoDB 3.1 now supports date type as part of their new internal storage format VelocyPack. 据我所知,ArangoDB 3.1现在支持日期类型作为其新内部存储格式VelocyPack的一部分。 How I am supposed to use fields with date type in AQL queries (eg FILTER)? 我应该如何在AQL查询中使用具有日期类型的字段(例如FILTER)? Looks like the documentation is not yet updated for date type fields: https://docs.arangodb.com/devel/AQL/Functions/Date.html 看起来日期类型字段的文档尚未更新: https//docs.arangodb.com/devel/AQL/Functions/Date.html

Can someone provide an AQL query example? 有人可以提供AQL查询示例吗? Something like 就像是

FOR p IN person FILTER p.birthday == '2016-11-04' RETURN p

where the field p.birthday is of date type? 字段p.birthday是日期类型?

Because VelocyPack is primary used as ArangoDBs internal storage format, the additional VelocyPack types are currently not supported by AQL, the shell or the web-ui. 由于VelocyPack主要用作ArangoDBs内部存储格式,因此AQL,shell或web-ui目前不支持其他VelocyPack类型。 They all have to use json for processing. 他们都必须使用json进行处理。

Currently the only way to create a document with a date type is over the Java-Driver (version 4.1.0). 目前,创建具有日期类型的文档的唯一方法是使用Java-Driver(版本4.1.0)。 The driver is also the only possibility to get VelocyPack as a result from an AQL query. 驱动程序也是唯一可能因AQL查询而获得VelocyPack的可能性。 Every other implementation returns you json naturally without the additional VelocyPack types. 每个其他实现都会自然地返回json,而不需要额外的VelocyPack类型。

Apart from this the AQL-date functions do not support VelocyPack date type at the current state of development. 除此之外,AQL-date函数在当前开发状态​​下不支持VelocyPack日期类型。

ArangoDB uses VelocyPack as the internal storage format since ArangoDB version 3.0. 自ArangoDB版本3.0起,ArangoDB使用VelocyPack作为内部存储格式。 VelocyPack has a Date datetype as well as some other datatypes which are not present in JSON. VelocyPack具有Date类型以及JSON中不存在的一些其他数据类型。

But even though VelocyPack is used as the internal storage format in ArangoDB, all external APIs of ArangoDB still are JSON-based, meaning they only support the datatypes natively supported by JSON (null, boolean, number, string, array, object). 但即使VelocyPack用作ArangoDB中的内部存储格式,ArangoDB的所有外部API仍然是基于JSON的,这意味着它们仅支持JSON本身支持的数据类型(null,boolean,number,string,array,object)。

Support for more (non-JSON) datatypes is on the roadmap, but is not there yet as of ArangoDB 3.1. 支持更多(非JSON)数据类型在路线图上,但是从ArangoDB 3.1开始还没有。 Supporting more datatypes requires writing some internal wrapper functions for these datatypes plus make all the AQL operators work correctly with them. 支持更多数据类型需要为这些数据类型编写一些内部包装函数,并使所有AQL运算符与它们一起正常工作。

So in version 3.1 the options for saving date values are still to use datetime strings (eg in ISO8601 format such as 2016-11-10T14:08:20.236Z ) or to use number values for storing timestamps. 因此,在版本3.1中,保存日期值的选项仍然是使用日期时间字符串(例如,采用ISO8601格式,如2016-11-10T14:08:20.236Z使用数值来存储时间戳。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM