private function convertProperty($name)
    {
        if (isset($this->_schema[$name]['null']) && $this->_schema[$name]['null'] && $this->$name === null) {
            return;
        }

        switch ($this->_schema[$name]['type']) {
        case Object::TYPE_ID:
            if (!($this->$name instanceof MongoId) && $this->$name !== null) {
                $this->$name = new MongoId($this->$name);
            }
            break;
        case Object::TYPE_BOOL:
            if (!is_bool($this->$name)) {
                $this->$name = (bool) $this->$name;
            }
            break;
        case Object::TYPE_INT:
            if (!is_int($this->$name)) {
                $this->$name = (int) $this->$name;
            }
            break;
        case Object::TYPE_DOUBLE:
            if (!is_double($this->$name)) {
                $this->$name = (double) $this->$name;
            }
            break;
        case Object::TYPE_STRING:
            if (!is_string($this->$name)) {
                $this->$name = (string) $this->$name;
            }
            break;
        case Object::TYPE_ARRAY:
            if (!is_array($this->$name)) {
                $this->$name = [];
            }
            break;
        case Object::TYPE_DATE:
            if (!($this->$name instanceof MongoDate)) {
                $this->$name = new MongoDate($this->$name);
            }
            break;
        case Object::TYPE_REFERENCE:
            if (!MongoDBRef::isRef($this->$name)) {
                $this->$name = null;
            }
            break;
        default:
            throw new Exception("Property '{$name}' type is unknown ({$this->_schema[$name]['type']})");
        }
        return null;
    }