Created
July 24, 2014 21:22
-
-
Save parshap/fe952e2306047cc9a985 to your computer and use it in GitHub Desktop.
Mongoose nested object unexpectd value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require("mongoose"); | |
var schema = new mongoose.Schema({ | |
nestedProp: { | |
bar: String, | |
baz: String, | |
}, | |
}); | |
var MyModel = mongoose.model("MyModel", schema); | |
var foo = new MyModel(); | |
foo.set("nestedProp", {}); | |
console.log(foo.get("nestedProp")); | |
// -> `null`, expected `{}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This might be related to you.
Automattic/mongoose#1148