Skip to content

Instantly share code, notes, and snippets.

@parshap
Created July 24, 2014 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parshap/fe952e2306047cc9a985 to your computer and use it in GitHub Desktop.
Save parshap/fe952e2306047cc9a985 to your computer and use it in GitHub Desktop.
Mongoose nested object unexpectd value
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 `{}`
@avishaan
Copy link

This might be related to you.
Automattic/mongoose#1148

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