GoLang MongoId::__toString

request it (402)
GoLang replacement for PHP's MongoId::__toString [edit | history]



Do you know a GoLang replacement for PHP's MongoId::__toString? Write it!

PHP MongoId::__toString

PHP original manual for MongoId::__toString [ show | php.net ]

MongoId::__toString

(PECL mongo >= 0.8.0)

MongoId::__toStringReturns a hexidecimal representation of this id

Description

public string MongoId::__toString ( void )

Parameters

This function has no parameters.

Return Values

This id.

Examples

Example #1 MongoId::__toString() example

<?php

$m 
= new MongoClient();
$collection $m->selectDB("foo")->selectCollection("bar");

$collection->insert(array( "x" => "y" ));
$collection->insert(array( "x" => "y" ));

$cursor $collection->find();
$r1 $cursor->next();
$r2 $cursor->next();

echo 
$r1["_id"] . "\n";
echo 
$r2["_id"] . "\n";

?>

The above example will output something similar to:

49a7011a05c677b9a916612a
49a702d5450046d3d515d10d