Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the MongoDB CPAN distribution.

Maintainer(s)' notes

Please don't report bugs here. Please use the MongoDB Perl driver issue tracker instead.

Report information
The Basics
Id: 66454
Status: resolved
Priority: 0/
Queue: MongoDB

People
Owner: Nobody in particular
Requestors: jmeek [...] vailsys.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: MongoDB::DataTypes documentation problem
Date: Mon, 07 Mar 2011 13:11:07 -0600
To: bug-MongoDB [...] rt.cpan.org
From: James Meek <jmeek [...] vailsys.com>
The 'Kristina Chodorow > MongoDB-0.32 > MongoDB::DataTypes' documentation for the Perl interface misleadingly gives the syntax for creating a MongoDB::OID from an existing 24-character hexadecimal string as: my $oid = MongoDB::OID->new("123456789012345678901234"); In fact, this creates a new, unique ObjectId. The correct syntax for cloning an existing ObjectId from its character-string representation (per 'Kristina Chodorow > MongoDB-0.42 > MongoDB::OID', which is correct), is: my $oid = MongoDB::OID->new( { value => "123456789012345678901234" }); So far, the only way I have found to re-access a MongoDB object using the 24-character representation of its '_id' is to use syntax such as: $db->theCollectionName->find_one( {'_id' => MongoDB::OID->new( value => $objId_24_char_representation ) } ) It would seem like a good idea to add this (or any better method that might exist) to the Tutorial.
Aha! I've been wondering where people have been getting the incorrect syntax (it is correct in the MongoDB::OID documentation). Thanks, I've fixed this in the main source tree.