简体   繁体   中英

How to insert Date to ArangoDB?

I can't understand what format use ArangoDB for date storage. Attempt to insert date in such format: {"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'.

It's look like vibed JSON module fail on this string, but what format use Arango?

String in format {"name":"vasia","date":"2013-01-15"} inserting in DB successfully, but I can't understand is it's inserting as text or as Date object?

Is it inserting as text or as Date object?

As text, because ArangoDB only supports JSON data types . JSON doesn't have a Date type, so dates are usually encoded as strings. How you actually do that is up to you, but since you're using D, I suggest you use Date.toISOExtString . For a few other options, see this question .

I haven't used ArangoDB, but the ArangoDB date documentation suggest you use something like DATE_TIMESTAMP("2013-01-15T14:19:09.522") and / or DATE_ISO8601("2013-01-15T14:19:09.522Z") . Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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