NAME

MojoX::MongoDB::DateTime

SYNOPSIS

my $dt = MojoX::MongoDB::DateTime->from_epoch( epoch => time() );
$conn->Foo->Bar->insert({ date => $dt });

DESCRIPTION

The original MongoDB driver uses the DateTime module to read and write dates to Mongo. This can be a considerable bottleneck for web applications due to the slow speed of DateTime. This module implements a very light datetime object, based on the system c<time>.

ATTRIBUTES

epoch

Returns the time in seconds since the UTC epoch.

dt

Returns a DateTime object created from the current object

millisecond

Always returns 0. This only exists for compatibility.

SUBROUTINES

new

Creates a new object and initializes it with the current time.

from_epoch

my $dt = MojoX::MongoDB::DateTime->from_epoch( epoch => time - 3600 );

Creates a datetime object with an arbitrary time.

AUTHOR

minimalist <minimalist@lavabit.com>