added methods to MongoDriver for custom commands, findAndModify, count
This commit is contained in:
@ -18,6 +18,8 @@ class MongoCommandBuilder
|
||||
|
||||
const REMOVE = 'Remove';
|
||||
|
||||
const COMMAND = 'Command';
|
||||
|
||||
static public function factory($type, $collection = null)
|
||||
{
|
||||
$class = ucfirst($type) . 'MongoCommand';
|
||||
@ -167,4 +169,26 @@ class RemoveMongoCommand extends MongoDbCommand
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CommandMongoCommand extends MongoDbCommand
|
||||
{
|
||||
protected $command;
|
||||
|
||||
protected function concreteExecute()
|
||||
{
|
||||
$db = $this->collection->db;
|
||||
if($db instanceof MongoDB) {
|
||||
return $db->command($this->command);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkParams()
|
||||
{
|
||||
if (isset($this->collection) && isset($this->command)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user