Files
mongo-php-driver/tests/standalone/manager-executeUpdate-003.phpt
T
Hannes Magnusson 3efb11c140 PHPC-180: Rename constant and pass the cleanup uri explicitly
- Use the new connection string constant that includes auth
- Call the cleanup routines explicitly when needed
2015-03-16 20:30:15 -07:00

49 lines
905 B
PHP

--TEST--
MongoDB\Driver\Manager::executeUpdate() one document with upsert
--SKIPIF--
<?php require "tests/utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
--FILE--
<?php
require_once "tests/utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$result = $manager->executeUpdate(
NS,
array('_id' => 1),
array('$set' => array('x' => 1)),
array('multi' => false, 'upsert' => true)
);
echo "\n===> WriteResult\n";
printWriteResult($result);
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
===> WriteResult
server: %s:%d
insertedCount: 0
matchedCount: 0
modifiedCount: 0
upsertedCount: 1
deletedCount: 0
upsertedId[0]: int(1)
===> Collection
array(1) {
[0]=>
array(2) {
["_id"]=>
int(1)
["x"]=>
int(1)
}
}
===DONE===