MongoDBx::Class::ParsedAttribute::DateTime - An automatic DateTime parser for MongoDBx::Class document classes
# in one of your document classes has 'datetime' => (is => 'ro', isa => 'DateTime', traits => ['Parsed'], required => 1);
While the Perl MongoDB driver already supports DateTime objects natively, due to a bug with MongoDB, you can't save dates earlier than the UNIX epoch. This module overcomes this limitation by simply saving dates as strings and automatically turning them into DateTime objects (and vica-versa). The DateTime strings are formatted by the DateTime::Format::W3CDTF module, which parses dates in the format recommended by the W3C. This is good for web apps, and also makes it easier to edit dates from the MongoDB shell. But most importantly, it also allows sorting by date.
Note that if you already have date attributes in your database, you can't just start using this parser, you will first have to convert them to the W3C format.
A DateTime::Format::W3CDTF object used for expanding/collapsing. Automatically created.
Creates a new instance of this module.
Converts a W3C datetime string to DateTime object.
Converts a DateTime object to a W3C datetime string.
<ido at ido50.net>
Please report any bugs or feature requests to
bug-mongodbx-class at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MongoDBx-Class. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
You can also look for information at:
Copyright 2010-2012 Ido Perlmuter.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.