MongoDBx::AutoDeref::LookMeUp - Provides the sieve that replaces DBRefs with deferred scalars.
This module provides the guts for MongoDBx::AutoDeref. It modifies documents in place to replace DBRefs with actual objects that implement the deferred fetch. This class also will deflate those same objects back into plain hashes.
is: ro, isa: MongoDB::Connection, required: 1
In order to defer fetching the referenced document, a connection object needs to be accessible. This is required for construction of the object.
is: ro, isa: Data::Visitor::Callback lazy: 1, builder => _build_visitor handles: sieve => visit
In order to find the DBRefs within the returned document, Data::Visitor is used to traverse the structure. The raw hashes are replaced with proper objects that implement the lookup via "fetch" in MongoDBx::AutoDeref::DBRef. Upon insert/update, these objects are then deflated back to their raw hash references.
is: ro, isa: enum(input,output), required: 1
The LookMeUp object can operate in two modes. In the input mode, MongoDBx::AutoDeref::DBRef objects will be deflated to plain hashes. In output mode, plain hashes that pass the DBRef type constraint will be inflated.
This method takes the returned document from MongoDB and traverses it to replace DBRefs with defered lookups of the actual document. It does this IN PLACE on the document.
The obverse is true as well. If storing a document the document will be traversed and the DBRef objects will be deflated into plain hashes
Nicholas R. Perez <email@example.com>
This software is copyright (c) 2010 by Nicholas R. Perez <firstname.lastname@example.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.