--TEST-- MongoDB\Driver\Manager::executeBulkWrite() insert write error --SKIPIF-- --FILE-- insert(['$foo' => 1]); try { $manager->executeBulkWrite(NS, $bulk); } catch (MongoDB\Driver\Exception\BulkWriteException $e) { printf("BulkWriteException: %s\n", $e->getMessage()); echo "\n===> WriteResult\n"; printWriteResult($e->getWriteResult()); } ?> ===DONE=== --EXPECTF-- BulkWriteException: BulkWrite error ===> WriteResult server: %s:%d insertedCount: 0 matchedCount: 0 modifiedCount: 0 upsertedCount: 0 deletedCount: 0 object(MongoDB\Driver\WriteError)#%d (%d) { ["message"]=> string(48) "Document can't have $ prefixed field names: $foo" ["code"]=> int(2) ["index"]=> int(0) ["info"]=> NULL } writeError[0].message: Document can't have $ prefixed field names: $foo writeError[0].code: 2 ===DONE===