Skip to content

Commit 81477df

Browse files
committed
Merge pull request #23
2 parents ab3f051 + aa124d0 commit 81477df

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

src/Operation/Count.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function __construct($databaseName, $collectionName, array $filter = arra
8585
public function execute(Server $server)
8686
{
8787
$cursor = $server->executeCommand($this->databaseName, $this->createCommand());
88-
$cursor->setTypeMap(array('document' => 'array'));
88+
$cursor->setTypeMap(array('root' => 'array', 'document' => 'array'));
8989
$result = current($cursor->toArray());
9090

9191
if (empty($result['ok'])) {

src/Operation/CreateIndexes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private function executeCommand(Server $server)
9191
));
9292

9393
$cursor = $server->executeCommand($this->databaseName, $command);
94-
$cursor->setTypeMap(array('document' => 'array'));
94+
$cursor->setTypeMap(array('root' => 'array', 'document' => 'array'));
9595
$result = current($cursor->toArray());
9696

9797
if (empty($result['ok'])) {

src/Operation/ListCollections.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private function executeCommand(Server $server)
8585
}
8686

8787
$cursor = $server->executeCommand($this->databaseName, new Command($cmd));
88-
$cursor->setTypeMap(array('document' => 'array'));
88+
$cursor->setTypeMap(array('root' => 'array', 'document' => 'array'));
8989

9090
return new CollectionInfoCommandIterator($cursor);
9191
}
@@ -115,7 +115,7 @@ private function executeLegacy(Server $server)
115115
: array();
116116

117117
$cursor = $server->executeQuery($this->databaseName . '.system.namespaces', new Query($filter, $options));
118-
$cursor->setTypeMap(array('document' => 'array'));
118+
$cursor->setTypeMap(array('root' => 'array', 'document' => 'array'));
119119

120120
return new CollectionInfoLegacyIterator($cursor);
121121
}

src/Operation/ListDatabases.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function execute(Server $server)
5555
}
5656

5757
$cursor = $server->executeCommand('admin', new Command($cmd));
58-
$cursor->setTypeMap(array('document' => 'array'));
58+
$cursor->setTypeMap(array('root' => 'array', 'document' => 'array'));
5959
$result = current($cursor->toArray());
6060

6161
if (empty($result['ok'])) {

src/Operation/ListIndexes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private function executeCommand(Server $server)
7676
}
7777

7878
$cursor = $server->executeCommand($this->databaseName, new Command($cmd));
79-
$cursor->setTypeMap(array('document' => 'array'));
79+
$cursor->setTypeMap(array('root' => 'array', 'document' => 'array'));
8080

8181
return new IndexInfoIteratorIterator($cursor);
8282
}
@@ -97,7 +97,7 @@ private function executeLegacy(Server $server)
9797
: array();
9898

9999
$cursor = $server->executeQuery($this->databaseName . '.system.indexes', new Query($filter, $options));
100-
$cursor->setTypeMap(array('document' => 'array'));
100+
$cursor->setTypeMap(array('root' => 'array', 'document' => 'array'));
101101

102102
return new IndexInfoIteratorIterator($cursor);
103103
}

tests/Collection/CollectionFunctionalTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public function testFindOne()
2929
'sort' => array('x' => -1),
3030
);
3131

32-
$expected = array('_id' => 3, 'x' => 33);
32+
$expected = (object) array('_id' => 3, 'x' => 33);
3333

34-
$this->assertSame($expected, $this->collection->findOne($filter, $options));
34+
$this->assertEquals($expected, $this->collection->findOne($filter, $options));
3535
}
3636

3737
/**

tests/FunctionalTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function assertCollectionCount($namespace, $count)
2323
list($databaseName, $collectionName) = explode('.', $namespace, 2);
2424

2525
$cursor = $this->manager->executeCommand($databaseName, new Command(array('count' => $collectionName)));
26-
$cursor->setTypeMap(array('document' => 'array'));
26+
$cursor->setTypeMap(array('root' => 'array', 'document' => 'array'));
2727
$document = current($cursor->toArray());
2828

2929
$this->assertArrayHasKey('n', $document);
@@ -76,7 +76,7 @@ protected function getServerVersion(ReadPreference $readPreference = null)
7676
$readPreference ?: new ReadPreference(ReadPreference::RP_PRIMARY)
7777
);
7878

79-
$cursor->setTypeMap(array('document' => 'array'));
79+
$cursor->setTypeMap(array('root' => 'array', 'document' => 'array'));
8080
$document = current($cursor->toArray());
8181

8282
return $document['version'];

0 commit comments

Comments
 (0)