Document::Transform::Backend::MongoDB - Talk to a MongoDB via a simple interface
version 1.110530
use Document::Transform::Backend::MongoDB; my $backend = Document::Transform::Backend::MongoDB->new( host => $ENV{MONGOD} database_name => 'foo', transform_collection => 'transforms', document_collection => 'documents'); my $doc = $backend->fetch_document_from_key( MongoDB::OID->new(value => 'deadbeef'));
So you need Document::Transform to talk MongoDB. You're in luck, bucko, because this module is your godsend. And it comes by default! Now, there are a couple of different ways to instantiate this and different levels of attributes that can be filled. You can plug in the collections, you can plug in collection names and a database instance, you can plug in collection names, a database name, and connection instance. And if you don't have any instances then some connection info, database name, and collection names are all you need! So it is like you pick your level of support when calling into a PBS telethon.
is: ro, isa: Moose::Meta::TypeConstraint builder: _build_document_constraint, lazy: 1
This attribute implements "document_constraint" in Document::Transform::Role::Backend and provides a meaningful type constraint built using "document_id_key" in the where clause to check for the appropriate keys in the data structure that represents a document.
is: ro, isa: Moose::Meta::TypeConstraint builder: _build_transform_constraint, lazy: 1
This attribute implements "transform_constraint" in Document::Transform::Role::Backend and provides a meaningful type constraint built using "transform_id_key" in the where clause to check for the appropriate keys in the data structure that represents a transform.
is: ro, isa: Str
host contains the host string provided to the MongoDB::Connection constructor.
is: ro, isa: MongoDB::Connection, lazy: 1
This attribute holds the MongoDB connection object. If this isn't provided and it is accessed, a connection will be constructed using the "host" attribute.
If the collections are not provided, this attribute must be provided as a means to access the collections named in the "transform_collection" and "document_collection"
is: ro, isa: MongoDB::Database, lazy: 1
This attribute holds the MongoDB data in which the transform and document collections are held. If this isn't provided in the constructor, one will be constructed using the value from "database_name". If there is no value, an exception will be thrown.
If a collection is not passed to "documents", this attribute will be used to access a collection from the "database".
is: ro, isa: MongoDB::Collection, lazy: 1
This attribute holds the collection from MongoDB that should be the documents that should be fetched for transformation. If a collection is not passed to the constructor, one will be pulled from the database using the value from "document_collection"
If a collection is not passed to "transforms", this attribute will be used to access a collection from the "database".
This attribute holds the collection from MongoDB that should be the transforms that should be fetched for transformation. If a collection is not passed to the constructor, one will be pulled from the database using the value from "transform_collection"
is: ro, isa: Str, default: '_id',
is: ro, isa: Str, +default: '_id',
is: ro, isa: Str, +default: 'source',
This attribute holds the key used in the transform to reference the document to which this transform should occur.
(Defined)
This method implements the "fetch_document_from_key" in Docoument::Transform::Role::Backend method. It takes a single key that should match a document within the documents collection with the right "document_id_key" attribute.
This method implements the "fetch_transform_from_key" in Docoument::Transform::Role::Backend method. It takes a single key that should match a transform within the transforms collection with the right "transform_id_key" attribute.
(Transform)
This method implements the "fetch_document_from_transform" in Docoument::Transform::Role::Backend method. It takes a Transform defined by "transform_constraint" that has DBRef to a document stored with in the "reference_id_key" attribute of the transform.
This method is a no-op implementation of "fetch_transform_from_document" in Docoument::Transform::Role::Backend.
This method implements the "Document::Transform::Role::Backend/store_document" method with one key notable option. In addition to the document to store, a second boolean value can be passed to denote whether a "safe" insert/update should take place.
This method makes use of "document_id_key" to perform an update of the document.
This method implements the "Document::Transform::Role::Backend/store_transform" method with one key notable option. In addition to the transform to store, a second boolean value can be passed to denote whether a "safe" insert/update should take place.
This method makes use of "transform_id_key" to perform an update of the transform.
This method implements "has_document" in Document::Transform::Role::Backend. Simply provide a key and it will check Mongo if such a document exists using "document_id_key"
This method implements "has_transform" in Document::Transform::Role::Backend. Simply provide a key and it will check Mongo if such a transform exists using "transform_id_key"
(Document, Document)
This method implements "is_same_document" in Document::Transform::Role::Backend. It does a string comparison between the two documents values stored in "document_id_key". If using the default '_id' value for "document_id_key", this will stringify the MongoDB::OID objects down to their hex key and compare them.
(Transform, Transform)
This method implements "is_same_transform" in Transform::Transform::Role::Backend. It does a string comparison between the two transforms values stored in "transform_id_key". If using the default '_id' value for "transform_id_key", this will stringify the MongoDB::OID objects down to their hex key and compare them.
Nicholas R. Perez <nperez@cpan.org>
This software is copyright (c) 2010 by Infinity Interactive.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Document::Transform, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Document::Transform
CPAN shell
perl -MCPAN -e shell install Document::Transform
For more information on module installation, please visit the detailed CPAN module installation guide.