--TEST-- MongoDB\Driver\WriteError::getCode() --SKIPIF-- --FILE-- insert(['_id' => 1]); $bulk->insert(['_id' => 1]); $bulk->insert(['_id' => 1]); try { $manager->executeBulkWrite(NS, $bulk); } catch(MongoDB\Driver\Exception\BulkWriteException $e) { var_dump($e->getWriteResult()->getWriteErrors()[0]->getCode()); } ?> ===DONE=== --EXPECT-- int(11000) ===DONE===