public function testAggregate_ServerSideError()
{
$mongoDatabaseMock = $this->getMock('\\MongoDB', array('command'), array($this->collection->getDatabase()->getClient()->getMongoClient(), 'test'));
$mongoDatabaseMock->expects($this->once())->method('command')->will($this->returnValue(array('ok' => (double) 0, 'errmsg' => 'some_error', 'code' => 1785342)));
$database = new Database($this->collection->getDatabase()->getClient(), $mongoDatabaseMock);
$database->getCollection('phpmongo_test_collection')->aggregate(array(array('$match' => array('field' => 'value'))));
}