Added additional check when creating object from model with emded object... #859

Closed
wants to merge 3 commits into
from

Projects

None yet

2 participants

@agnek
Contributor
agnek commented Apr 24, 2012

Fix for error when loading model with emded document.

For example if we have such schema

var UserSchema = new Schema({
    user_id: Number,
    location: {
        city: {type: String, 'default': 'New York'},
        country: {type: String, 'default': 'USA'}
    }
})

and we will load document from database with such data

{
    user_id: 10,
    location: {city: "Washington"}
}

we will got broken object. When we will try to get country of such user we will get undefined value.

Collaborator

please add a regression test in

test/document.test.js

run tests with

make test
@aheckmann aheckmann added a commit that closed this pull request Jul 10, 2012
@aheckmann aheckmann fix minimize tests to reflect proper behavior
closes #859
e38412b
@aheckmann aheckmann closed this in e38412b Jul 10, 2012
Collaborator

merged. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment