public function deleteFileById($id)
    {
        if ($id instanceof \MongoId) {
            $result = $this->getMongoCollection()->delete($id);
        } else {
            try {
                $result = $this->getMongoCollection()->delete(new \MongoId($id));
            } catch (\MongoException $e) {
                $result = $this->getMongoCollection()->delete($id);
            }
        }
        if ($result['ok'] !== (double) 1) {
            throw new Exception('Error deleting file: ' . $result['err'] . ': ' . $result['errmsg']);
        }
        
        return $this;
    }