public function countObjects($type, $query = [])
    {
        $type = $this->getFullType($type);
        if (class_exists($type)) {
            $table = $type::getCollection();
            return $this->mongodb->$table->find($query, ['_id' => true])->count();
        }
        return false;
    }