-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
When writing tests (and importing scripts) it is very common to clear out a collection at the start of a script.
Right now however, when dropping a collection (haven't checked database), you get an exception if the collection does not exist with the base driver:
<?php use MongoDB\Driver; $a = new StdClass; $a->foo = 42; $a->bar = array( 5, 6, 7 ); $a->obj = array( "foo" => 44 ); $m = new Driver\Manager('mongodb://localhost:27017'); $c = new Driver\Command( [ 'drop' => 'doesnotexist'] ); $cursor = $m->executeCommand( 'demo', $c );
This is fine behaviour for the base drivers, but the "convenience library" should really wrap this, and IMO, ignore the "ns does not exist" exception, just like the legacy driver does.
- is related to
-
SERVER-20463 Error Code for database not found has changed for listIndexes
- Closed
- related to
-
PHPLIB-122 Checking ok field in command response is redundant
- Closed
-
PHPLIB-123 ListIndexes should not throw exception for nonexistent collection
- Closed