Skip to content

Allow nulls in setter #11

@mcsimps2

Description

@mcsimps2

This code doesn't look like it'll allow null values

if (schema[property.toString()].describe()['type'] === 'dbref') {
                        if (typeof value === 'string') {
                            
                            return Reflect.set(target, '__id__' + property.toString(), value)
                                    && Reflect.set(target, '__obj__' + property.toString(), null);
                        }
                        else if (value instanceof Document) {
                            return Reflect.set(target, '__id__' + property.toString(), value.id)
                                    && Reflect.set(target, '__obj__' + property.toString(), value);
                        }
                        else {
                            throw new Error("Can only set a foreign reference with an id or Document subclass instance")
                        }
                    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions