---
name: "MongoDBx::Class::Reference"
section: "3pm"
platform: "linux"
package: "libmongodbx-class-perl"
version: "1.030002-1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/MongoDBx::Class::Reference"
---

# MongoDBx::Class::Reference(3pm)

An embedded document representing a reference to a different document (thus establishing a relationship)

## NAME

MongoDBx::Class::Reference - An embedded document representing a reference to a different document (thus establishing a relationship)

## VERSION

version 1.030002

## CONSUMES

MongoDBx::Class::EmbeddedDocument

## DESCRIPTION

This class represents a reference (or "join") to a MongoDB document. In MongoDBx::Class, references are expected to be in the DBRef format, as defined in \<http://www.mongodb.org/display/DOCS/Database+References\>, for example (this is a JSON example):

```
        { "$ref": "collection_name", "$id": ObjectId("4cbca90d3a41e35916720100") }
```

## ATTRIBUTES

Aside from attributes provided by MongoDBx::Class::EmbeddedDocument, the following attributes are provided:

### ref\_coll

A string representing the collection in which the reference document is stored (translates to the '$ref' hash key above).

### ref\_id

A MongoDB::OID object with the internal ID of the referenced document (translates to the '$id' hash key above).

## METHODS

Aside from methods provided by MongoDBx::Class::EmbeddedDocument, the following methods are provided:

### *load()*

Returns the document referenced by this object, after expansion. This is mostly used internally, you don't have to worry about it.

## AUTHOR

Ido Perlmuter, `"<ido at ido50.net>"`

## BUGS

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.

## SUPPORT

You can find documentation for this module with the perldoc command.

```
        perldoc MongoDBx::Class::Reference
```

You can also look for information at:

- •

  RT: CPAN's request tracker

  \<http://rt.cpan.org/NoAuth/Bugs.html?Dist=MongoDBx::Class\>

- •

  AnnoCPAN: Annotated CPAN documentation

  \<http://annocpan.org/dist/MongoDBx::Class\>

- •

  CPAN Ratings

  \<http://cpanratings.perl.org/d/MongoDBx::Class\>

- •

  Search CPAN

  \<http://search.cpan.org/dist/MongoDBx::Class/\>

## SEE ALSO

MongoDBx::Class::EmbeddedDocument.

## LICENSE AND COPYRIGHT

Copyright 2010-2014 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.
