Kristina Chodorow > MongoDB > MongoDB::OID

Download:
MongoDB-0.26.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.26   Source  

NAME ^

MongoDB::OID - A Mongo Object ID

VERSION ^

version 0.26

SYNOPSIS ^

If no _id field is provided when a document is inserted into the database, an _id field will be added with a new MongoDB::OID as its value.

    my $id = $collection->insert({'name' => 'Alice', age => 20});

$id will be a MongoDB::OID that can be used to retreive or update the saved document:

    $collection->update({_id => $id}, {'age' => {'$inc' => 1}});
    # now Alice is 21

Warning: at the moment, OID generation is not thread safe.

ATTRIBUTES ^

value

The OID value. A random value will be generated if none exists already. It is a 24-character hexidecimal string (12 bytes).

Its string representation is the 24-character string.

AUTHOR ^

  Kristina Chodorow <kristina@mongodb.org>