{"action":"reopened","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/2930","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/2930/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/2930/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/2930/events","html_url":"https://github.com/Automattic/mongoose/issues/2930","id":71382549,"number":2930,"title":"Mixed data value reduced to null value during assignment iff data is object with empty fields ","user":{"login":"lazutkin","id":1035026,"avatar_url":"https://avatars.githubusercontent.com/u/1035026?v=3","gravatar_id":"","url":"https://api.github.com/users/lazutkin","html_url":"https://github.com/lazutkin","followers_url":"https://api.github.com/users/lazutkin/followers","following_url":"https://api.github.com/users/lazutkin/following{/other_user}","gists_url":"https://api.github.com/users/lazutkin/gists{/gist_id}","starred_url":"https://api.github.com/users/lazutkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lazutkin/subscriptions","organizations_url":"https://api.github.com/users/lazutkin/orgs","repos_url":"https://api.github.com/users/lazutkin/repos","events_url":"https://api.github.com/users/lazutkin/events{/privacy}","received_events_url":"https://api.github.com/users/lazutkin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Automattic/mongoose/labels/help","name":"help","color":"FFFFFF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-27T19:44:35Z","updated_at":"2015-07-16T21:57:32Z","closed_at":null,"body":"I've found that data is reduced into null values during assignment when deal with `Mixed` data. \r\n\r\nFor example:\r\n\r\n```javascript\r\nvar Person, Schema, db, mongoose;\r\n\r\nmongoose = require(\"mongoose\");\r\n\r\nSchema = mongoose.Schema;\r\n\r\nPerson = mongoose.model(\"Person\", new Schema({\r\n  some: mongoose.Schema.Types.Mixed\r\n}));\r\n\r\nmongoose.connect(\"mongodb://localhost/test\");\r\n\r\ndb = mongoose.connection;\r\n\r\ndb.on(\"open\", function() {\r\n  var doc;\r\n  doc = new Person();\r\n  doc.markModified('some');\r\n  doc.some = {\r\n    a: [\r\n      {\r\n        b: {}\r\n      }\r\n    ]\r\n  };\r\n  console.log('#1 %j', doc.toJSON().some);\r\n  doc.some = {\r\n    a: [{}]\r\n  };\r\n  console.log('#2 %j', doc.toJSON().some);\r\n  doc.some = {\r\n    a: [\r\n      {\r\n        b: {\r\n          c: 1\r\n        }\r\n      }\r\n    ]\r\n  };\r\n  return console.log('#3 %j', doc.toJSON().some);\r\n});\r\n```\r\n\r\nIt produces output:\r\n```\r\n#1 {\"a\":[null]}\r\n#2 {\"a\":[null]}\r\n#3 {\"a\":[{\"b\":{\"c\":1}}]}\r\n```\r\n\r\nI use `mongoose@3.8.22`"}}