|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-09-10 00:11 UTC] adam at hipsnip dot com
Description: ------------ --- From manual page: http://www.php.net/mongo.writes --- In version 1.2.x of the driver, when performing a write operation with the "safe => false" (unsafe) flag set, it would return a boolean value. In 1.3.0 (beta2) it appears that this is no longer the case, as these operations have no return value (null). While this makes sense - since we won't really know if the operation succeeded - this will break applications which expect that boolean return value. Therefore this change in behaviour should be noted on the documentation page for mongo write operations. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 19:00:01 2025 UTC |
This seems to be not the case in the 1.3.0 final release. It successfully reports bool(true) for me: <?php $m = new MongoClient(); $c = $m->selectDb(dbname())->bug605; $c->remove(); var_dump( $c->insert( array( 'test' => 'one' ) ) ); var_dump( $c->insert( array( 'test' => 'two' ), array( 'w' => 0 ) ) ); var_dump( $c->insert( array( 'test' => 'two' ), array( 'w' => 1 ) ) ); ?> returns (as expected): array(4) { ["n"]=> int(0) ["connectionId"]=> int(89) ["err"]=> NULL ["ok"]=> float(1) } bool(true) array(4) { ["n"]=> int(0) ["connectionId"]=> int(89) ["err"]=> NULL ["ok"]=> float(1) }