public function testSaveUpdate()
{
$expected = ['ok' => 1.0, 'nModified' => 1, 'n' => 1, 'err' => null, 'errmsg' => null, 'updatedExisting' => true];
$id = '54203e08d51d4a1f868b456e';
$collection = $this->getCollection();
$insertDocument = ['_id' => new \MongoId($id), 'foo' => 'bar'];
$saveDocument = ['_id' => new \MongoId($id), 'foo' => 'foo'];
$collection->insert($insertDocument);
$this->assertSame($expected, $collection->save($saveDocument));
$newCollection = $this->getCheckDatabase()->selectCollection('test');
$this->assertSame(1, $newCollection->count());
$object = $newCollection->findOne();
$this->assertNotNull($object);
$this->assertAttributeInstanceOf('MongoDB\\BSON\\ObjectID', '_id', $object);
$this->assertSame($id, (string) $object->_id);
$this->assertObjectHasAttribute('foo', $object);
$this->assertAttributeSame('foo', 'foo', $object);
}