Skip to content

Commit

Permalink
Address code review
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus committed Sep 27, 2024
1 parent adbcc64 commit 69cd29c
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions UPGRADE-2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ UPGRADE FROM 1.x to 2.0
* The `MongoDB\ChangeStream::CURSOR_NOT_FOUND` constant is now private.
* The `MongoDB\Operation\Watch::FULL_DOCUMENT_DEFAULT` constant has been
removed.
* The `getNamespace` and `isGeoHaystack` methods hav been removed from the
* The `getNamespace` and `isGeoHaystack` methods have been removed from the
`MongoDB\Model\IndexInfo` class.
* The `maxScan`, `modifiers`, `oplogReplay`, and `snapshot` options for `find`
and `findOne` operations have been removed.
* The `MongoDB\Collection::mapReduce` method has been removed. Use aggregation
pipeline instead.
* The `MongoDB\Collection::mapReduce` method has been removed. Use
[aggregation pipeline](https://www.mongodb.com/docs/manual/reference/map-reduce-to-aggregation-pipeline/)
instead.
* The following classes and interfaces have been removed without replacement:
* `MongoDB\MapReduceResult`
* `MongoDB\Model\CollectionInfoCommandIterator`
Expand Down
1 change: 1 addition & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ public function getWriteConcern(): WriteConcern
* List database names.
*
* @see ListDatabaseNames::__construct() for supported options
* @return Iterator<int, string>
* @throws UnexpectedValueException if the command response was malformed
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
Expand Down
1 change: 1 addition & 0 deletions src/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ public function getWriteConcern(): WriteConcern
* Returns the names of all collections in this database
*
* @see ListCollectionNames::__construct() for supported options
* @return Iterator<int, string>
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Operation/ListCollectionNames.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(string $databaseName, array $options = [])
/**
* Execute the operation.
*
* @return Iterator
* @return Iterator<int, string>
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server): Iterator
Expand Down
1 change: 1 addition & 0 deletions src/Operation/ListDatabaseNames.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function __construct(array $options = [])
/**
* Execute the operation.
*
* @return Iterator<int, string>
* @throws UnexpectedValueException if the command response was malformed
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
Expand Down
1 change: 0 additions & 1 deletion stubs/Driver/CursorInterface.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Iterator;
use MongoDB\BSON\Int64;
use Traversable;

/**
* @template TValue of array|object
Expand Down
2 changes: 2 additions & 0 deletions tests/Operation/ListCollectionsFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public function testIdIndexAndInfo(): void
foreach ($collections as $collection) {
$this->assertInstanceOf(CollectionInfo::class, $collection);
$this->assertArrayHasKey('readOnly', $collection['info']);
// Use assertMatchesDocument as MongoDB 4.0 and 4.2 include a ns field
// TODO: change to assertEquals when dropping support for MongoDB 4.2
$this->assertMatchesDocument(['v' => 2, 'key' => ['_id' => 1], 'name' => '_id_'], $collection['idIndex']);
}
}
Expand Down

0 comments on commit 69cd29c

Please sign in to comment.