Phalcon\Mvc\MongoCollection::_exists PHP Method

_exists() protected method

@codingStandardsIgnoreStart
protected _exists ( $collection )
    protected function _exists($collection)
    {
        // @codingStandardsIgnoreStart
        if (!($id = $this->_id)) {
            return false;
        }
        if (is_object($id)) {
            $mongoId = $id;
        } else {
            /**
             * Check if the model use implicit ids
             */
            if ($this->_modelsManager->isUsingImplicitObjectIds($this)) {
                $mongoId = new ObjectID($id);
            } else {
                $mongoId = $id;
            }
        }
        /**
         * Perform the count using the function provided by the driver
         */
        return $collection->count(["_id" => $mongoId]) > 0;
    }