diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index 7e99f32d6..039b43007 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -360,6 +360,9 @@
+
+
+
@@ -368,6 +371,9 @@
+
+
+
databases)]]>
@@ -376,6 +382,11 @@
databases)]]>
+
+
+
+
+
index]]>
@@ -774,7 +785,22 @@
+
+
+ listCollections->execute($server), $this->databaseName)]]>
+
+
+
+
+ listDatabases->execute($server))]]>
+
+
+
+
+ databaseName . '.' . $this->collectionName)]]>
+
+
diff --git a/src/Client.php b/src/Client.php
index 2e161707b..5ed76a0e0 100644
--- a/src/Client.php
+++ b/src/Client.php
@@ -38,7 +38,7 @@
use MongoDB\Exception\UnsupportedException;
use MongoDB\Model\BSONArray;
use MongoDB\Model\BSONDocument;
-use MongoDB\Model\DatabaseInfoIterator;
+use MongoDB\Model\DatabaseInfo;
use MongoDB\Operation\DropDatabase;
use MongoDB\Operation\ListDatabaseNames;
use MongoDB\Operation\ListDatabases;
@@ -313,7 +313,7 @@ public function listDatabaseNames(array $options = []): Iterator
* List databases.
*
* @see ListDatabases::__construct() for supported options
- * @return DatabaseInfoIterator
+ * @return Iterator
* @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)
diff --git a/src/Collection.php b/src/Collection.php
index 8ed460c4e..ab82cca5d 100644
--- a/src/Collection.php
+++ b/src/Collection.php
@@ -38,7 +38,6 @@
use MongoDB\Model\BSONArray;
use MongoDB\Model\BSONDocument;
use MongoDB\Model\IndexInfo;
-use MongoDB\Model\IndexInfoIterator;
use MongoDB\Operation\Aggregate;
use MongoDB\Operation\BulkWrite;
use MongoDB\Operation\Count;
@@ -907,7 +906,7 @@ public function insertOne(array|object $document, array $options = [])
* Returns information for all indexes for the collection.
*
* @see ListIndexes::__construct() for supported options
- * @return IndexInfoIterator
+ * @return Iterator
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
diff --git a/src/Database.php b/src/Database.php
index 125012c81..4d15637a4 100644
--- a/src/Database.php
+++ b/src/Database.php
@@ -37,7 +37,7 @@
use MongoDB\GridFS\Bucket;
use MongoDB\Model\BSONArray;
use MongoDB\Model\BSONDocument;
-use MongoDB\Model\CollectionInfoIterator;
+use MongoDB\Model\CollectionInfo;
use MongoDB\Operation\Aggregate;
use MongoDB\Operation\CreateCollection;
use MongoDB\Operation\CreateEncryptedCollection;
@@ -491,7 +491,7 @@ public function listCollectionNames(array $options = []): Iterator
* Returns information for all collections in this database.
*
* @see ListCollections::__construct() for supported options
- * @return CollectionInfoIterator
+ * @return Iterator
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
diff --git a/src/Model/CollectionInfoCommandIterator.php b/src/Model/CollectionInfoCommandIterator.php
index 14ef39a02..543d8fc38 100644
--- a/src/Model/CollectionInfoCommandIterator.php
+++ b/src/Model/CollectionInfoCommandIterator.php
@@ -30,6 +30,7 @@
* @see \MongoDB\Database::listCollections()
* @see https://github.com/mongodb/specifications/blob/master/source/enumerate-collections.rst
* @see https://mongodb.com/docs/manual/reference/command/listCollections/
+ * @deprecated
* @template-extends IteratorIterator>
*/
class CollectionInfoCommandIterator extends IteratorIterator implements CollectionInfoIterator
diff --git a/src/Model/CollectionInfoIterator.php b/src/Model/CollectionInfoIterator.php
index 1a68cf905..e7ebf4984 100644
--- a/src/Model/CollectionInfoIterator.php
+++ b/src/Model/CollectionInfoIterator.php
@@ -26,6 +26,7 @@
* This iterator is used for enumerating collections in a database.
*
* @see \MongoDB\Database::listCollections()
+ * @deprecated
* @template-extends Iterator
*/
interface CollectionInfoIterator extends Iterator
diff --git a/src/Model/DatabaseInfoIterator.php b/src/Model/DatabaseInfoIterator.php
index b6052e8e5..72199bd32 100644
--- a/src/Model/DatabaseInfoIterator.php
+++ b/src/Model/DatabaseInfoIterator.php
@@ -26,6 +26,7 @@
* This iterator is used for enumerating databases on a server.
*
* @see \MongoDB\Client::listDatabases()
+ * @deprecated
* @template-extends Iterator
*/
interface DatabaseInfoIterator extends Iterator
diff --git a/src/Model/DatabaseInfoLegacyIterator.php b/src/Model/DatabaseInfoLegacyIterator.php
index da657acec..1348b0c57 100644
--- a/src/Model/DatabaseInfoLegacyIterator.php
+++ b/src/Model/DatabaseInfoLegacyIterator.php
@@ -31,6 +31,7 @@
* @internal
* @see \MongoDB\Client::listDatabases()
* @see https://mongodb.com/docs/manual/reference/command/listDatabases/
+ * @deprecated
*/
class DatabaseInfoLegacyIterator implements DatabaseInfoIterator
{
diff --git a/src/Model/IndexInfo.php b/src/Model/IndexInfo.php
index 45eea5027..53b7b63f0 100644
--- a/src/Model/IndexInfo.php
+++ b/src/Model/IndexInfo.php
@@ -93,10 +93,14 @@ public function getName()
/**
* Return the index namespace (e.g. "db.collection").
*
+ * @deprecated
+ *
* @return string
*/
public function getNamespace()
{
+ @trigger_error('MongoDB 4.4 drops support for the namespace in indexes, the method "IndexInfo::getNamespace()" will be removed in a future release', E_USER_DEPRECATED);
+
return (string) $this->info['ns'];
}
@@ -128,7 +132,7 @@ public function is2dSphere()
*/
public function isGeoHaystack()
{
- trigger_error('MongoDB 5.0 removes support for "geoHaystack" indexes, the method "IndexInfo::isGeoHaystack()" will be removed in a future release', E_USER_DEPRECATED);
+ @trigger_error('MongoDB 5.0 removes support for "geoHaystack" indexes, the method "IndexInfo::isGeoHaystack()" will be removed in a future release', E_USER_DEPRECATED);
return array_search('geoHaystack', $this->getKey(), true) !== false;
}
diff --git a/src/Model/IndexInfoIterator.php b/src/Model/IndexInfoIterator.php
index af6750e00..b7929c20f 100644
--- a/src/Model/IndexInfoIterator.php
+++ b/src/Model/IndexInfoIterator.php
@@ -26,6 +26,7 @@
* This iterator is used for enumerating indexes in a collection.
*
* @see \MongoDB\Collection::listIndexes()
+ * @deprecated
* @template-extends Iterator
*/
interface IndexInfoIterator extends Iterator
diff --git a/src/Model/IndexInfoIteratorIterator.php b/src/Model/IndexInfoIteratorIterator.php
index a2fa85d6f..0bcc4bd85 100644
--- a/src/Model/IndexInfoIteratorIterator.php
+++ b/src/Model/IndexInfoIteratorIterator.php
@@ -34,6 +34,7 @@
* @see https://github.com/mongodb/specifications/blob/master/source/enumerate-indexes.rst
* @see https://mongodb.com/docs/manual/reference/command/listIndexes/
* @see https://mongodb.com/docs/manual/reference/system-collections/
+ * @deprecated
* @template-extends IteratorIterator>
*/
class IndexInfoIteratorIterator extends IteratorIterator implements IndexInfoIterator
diff --git a/src/Operation/ListCollections.php b/src/Operation/ListCollections.php
index 29b53df7c..6a877b17f 100644
--- a/src/Operation/ListCollections.php
+++ b/src/Operation/ListCollections.php
@@ -17,12 +17,13 @@
namespace MongoDB\Operation;
+use Iterator;
use MongoDB\Command\ListCollections as ListCollectionsCommand;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Driver\Server;
use MongoDB\Exception\InvalidArgumentException;
+use MongoDB\Model\CollectionInfo;
use MongoDB\Model\CollectionInfoCommandIterator;
-use MongoDB\Model\CollectionInfoIterator;
/**
* Operation for the listCollections command.
@@ -70,7 +71,7 @@ public function __construct(private string $databaseName, array $options = [])
* Execute the operation.
*
* @see Executable::execute()
- * @return CollectionInfoIterator
+ * @return Iterator
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
diff --git a/src/Operation/ListDatabases.php b/src/Operation/ListDatabases.php
index 2e7e36b22..8aa31ac1f 100644
--- a/src/Operation/ListDatabases.php
+++ b/src/Operation/ListDatabases.php
@@ -17,12 +17,13 @@
namespace MongoDB\Operation;
+use Iterator;
use MongoDB\Command\ListDatabases as ListDatabasesCommand;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Driver\Server;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnexpectedValueException;
-use MongoDB\Model\DatabaseInfoIterator;
+use MongoDB\Model\DatabaseInfo;
use MongoDB\Model\DatabaseInfoLegacyIterator;
/**
@@ -70,7 +71,7 @@ public function __construct(array $options = [])
* Execute the operation.
*
* @see Executable::execute()
- * @return DatabaseInfoIterator
+ * @return Iterator
* @throws UnexpectedValueException if the command response was malformed
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
diff --git a/src/Operation/ListIndexes.php b/src/Operation/ListIndexes.php
index 351b88bac..1116a25a6 100644
--- a/src/Operation/ListIndexes.php
+++ b/src/Operation/ListIndexes.php
@@ -18,6 +18,7 @@
namespace MongoDB\Operation;
use EmptyIterator;
+use Iterator;
use MongoDB\Driver\Command;
use MongoDB\Driver\Exception\CommandException;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
@@ -25,7 +26,7 @@
use MongoDB\Driver\Session;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Model\CachingIterator;
-use MongoDB\Model\IndexInfoIterator;
+use MongoDB\Model\IndexInfo;
use MongoDB\Model\IndexInfoIteratorIterator;
use function is_integer;
@@ -77,7 +78,7 @@ public function __construct(private string $databaseName, private string $collec
* Execute the operation.
*
* @see Executable::execute()
- * @return IndexInfoIterator
+ * @return Iterator
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)