Re: MongoDB\Driver\CursorId::getTimestamp() ?

From: Derick Rethans <derick@xxxxxxxxxxx>
To: mongodb-user <mongodb-user@xxxxxxxxxxxxxxxx>
Date: Mon, 25 Apr 2016 11:58:38 +0100 (BST)
Why ads?
On Sun, 24 Apr 2016, Момчил Божинов wrote:

I seems to work, but 
I when I do the find I have to loose the existing type map settings (e.g. 
['root' => 'array', 'document' => 'array']) and work with objects

Not much of a problem, but an inconvenience

You should not need to change the typemap. The following works:

<?php
$manager = new \MongoDB\Driver\Manager;
$query = new \MongoDB\Driver\Query( [] );

$cursor = $manager->executeQuery( 'dramio.checkins', $query );
$cursor->setTypeMap( ['root' => 'array', 'document' => 'array'] );
  
$results = $cursor->toArray();
    
echo hexdec(substr((string) $results[0]['_id'], 0, 8)), "\n";
?>

(outputs "1452730554").

cheers,
Derick

-- 
{
  website: [ "http://mongodb.org", "http://derickrethans.nl" ;],
  twitter: [ "@derickr", "@mongodb" ]
}

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
--- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to mongodb-user@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/alpine.DEB.2.20.1604251153550.3391%40whisky.home.derickrethans.nl.
For more options, visit https://groups.google.com/d/optout.
Why ads?