vibe.d beta banner
get vibe.d

Asynchronous I/O that doesn’t get in your way, written in D

Function BsonObjectID.createDateID

Creates a pseudo object ID that matches the given date.

static BsonObjectID createDateID (
  in const(std.datetime.systime.SysTime) time
) @safe;

This kind of ID can be useful to query a database for items in a certain date interval using their ID. This works using the property of standard BSON object IDs that they store their creation date as part of the ID. Note that this date part is only 32-bit wide and is limited to the same timespan as a 32-bit Unix timestamp.


Sönke Ludwig


© 2012-2015 Sönke Ludwig


Subject to the terms of the MIT license, as written in the included LICENSE.txt file.