public function remove($col, $cond = [], $cb = null, $params = [])
{
if (mb_orig_strpos($col, '.') === false) {
$col = $this->dbname . '.' . $col;
}
if (is_string($cond)) {
$cond = new \MongoCode($cond);
}
if ($this->safeMode && is_array($cond)) {
static::safeModeEnc($cond);
}
try {
$this->request(self::OP_DELETE, "" . $col . "" . "" . bson_encode($cond), false, null, function ($conn, $reqId = null) use($col, $cb, $params) {
if (!$conn) {
!$cb || $cb(['$err' => 'Connection error.']);
return;
}
if ($cb !== null) {
$this->lastError($col, $cb, $params, $conn);
}
});
} catch (\MongoException $e) {
Daemon::log('MongoClient exception: ' . $e->getMessage() . ': ' . $e->getTraceAsString());
if ($cb !== null) {
$cb(['$err' => $e->getMessage(), '$query' => $cond]);
}
}
}