{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/3752","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/3752/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/3752/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/3752/events","html_url":"https://github.com/Automattic/mongoose/issues/3752","id":126025475,"number":3752,"title":"'calculateObjectSize' of null","user":{"login":"blyork","id":469793,"avatar_url":"https://avatars.githubusercontent.com/u/469793?v=3","gravatar_id":"","url":"https://api.github.com/users/blyork","html_url":"https://github.com/blyork","followers_url":"https://api.github.com/users/blyork/followers","following_url":"https://api.github.com/users/blyork/following{/other_user}","gists_url":"https://api.github.com/users/blyork/gists{/gist_id}","starred_url":"https://api.github.com/users/blyork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blyork/subscriptions","organizations_url":"https://api.github.com/users/blyork/orgs","repos_url":"https://api.github.com/users/blyork/repos","events_url":"https://api.github.com/users/blyork/events{/privacy}","received_events_url":"https://api.github.com/users/blyork/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2016-01-11T20:06:39Z","updated_at":"2016-01-14T21:34:45Z","closed_at":null,"body":"I recently started receiving this error:\r\n\r\n```\r\nC:\\sensorfact\\npm\\node_modules\\mongodb\\lib\\bulk\\unordered.js:147\r\n  var bsonSize = _self.s.bson.calculateObjectSize(document, false);\r\n                             ^\r\n\r\nTypeError: Cannot read property 'calculateObjectSize' of null\r\n    at addToOperationsList (C:\\sensorfact\\npm\\node_modules\\mongodb\\lib\\bulk\\unordered.js:147:30)\r\n    at UnorderedBulkOperation.raw (C:\\sensorfact\\npm\\node_modules\\mongodb\\lib\\bulk\\unordered.js:390:7)\r\n    at bulkWrite (C:\\sensorfact\\npm\\node_modules\\mongodb\\lib\\collection.js:584:10)\r\n    at Collection.insertMany (C:\\sensorfact\\npm\\node_modules\\mongodb\\lib\\collection.js:483:44)\r\n    at wrapped [as insertMany] (C:\\sensorfact\\npm\\node_modules\\newrelic\\lib\\instrumentation\\mongodb.js:177:25)\r\n    at Collection.insert (C:\\sensorfact\\npm\\node_modules\\mongodb\\lib\\collection.js:766:15)\r\n    at wrapped [as insert] (C:\\sensorfact\\npm\\node_modules\\newrelic\\lib\\instrumentation\\mongodb.js:177:25)\r\n    at NativeCollection.(anonymous function) [as insert] (C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\drivers\\node-mongodb-native\\collection.js:136:28)\r\n    at model.Model.$__handleSave (C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\model.js:130:21)\r\n    at model.Model.$__save (C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\model.js:189:9)\r\n    at C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\model.js:288:11\r\n    at new Promise.ES6 (C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\promise.js:45:3)\r\n    at model.Model.save (C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\model.js:287:10)\r\n    at model._done (C:\\sensorfact\\npm\\node_modules\\hooks-fixed\\hooks.js:101:24)\r\n    at _next (C:\\sensorfact\\npm\\node_modules\\hooks-fixed\\hooks.js:64:28)\r\n    at fnWrapper (C:\\sensorfact\\npm\\node_modules\\hooks-fixed\\hooks.js:186:18)\r\n    at model.Object.defineProperty.value.fn (C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\schema.js:250:9)\r\n    at _next (C:\\sensorfact\\npm\\node_modules\\hooks-fixed\\hooks.js:62:30)\r\n    at fnWrapper (C:\\sensorfact\\npm\\node_modules\\hooks-fixed\\hooks.js:186:18)\r\n    at model.<anonymous> (C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\schema.js:230:13)\r\n    at next_ (C:\\sensorfact\\npm\\node_modules\\hooks-fixed\\hooks.js:89:34)\r\n    at fnWrapper (C:\\sensorfact\\npm\\node_modules\\hooks-fixed\\hooks.js:186:18)\r\n```\r\n\r\nAnd a while later after restarting:\r\n\r\n```\r\nC:\\sensorfact\\npm\\node_modules\\newrelic\\lib\\transaction\\tracer\\index.js:158\r\n     throw err\r\n     ^\r\n\r\nTypeError: Cannot read property 'calculateObjectSize' of null\r\n   at addToOperationsList (C:\\sensorfact\\npm\\node_modules\\mongodb\\lib\\bulk\\unordered.js:147:30)\r\n   at UnorderedBulkOperation.raw (C:\\sensorfact\\npm\\node_modules\\mongodb\\lib\\bulk\\unordered.js:390:7)\r\n   at bulkWrite (C:\\sensorfact\\npm\\node_modules\\mongodb\\lib\\collection.js:584:10)\r\n   at Collection.insertMany (C:\\sensorfact\\npm\\node_modules\\mongodb\\lib\\collection.js:483:44)\r\n   at wrapped [as insertMany] (C:\\sensorfact\\npm\\node_modules\\newrelic\\lib\\instrumentation\\mongodb.js:185:25)\r\n   at Collection.insert (C:\\sensorfact\\npm\\node_modules\\mongodb\\lib\\collection.js:766:15)\r\n   at wrapped (C:\\sensorfact\\npm\\node_modules\\newrelic\\lib\\transaction\\tracer\\index.js:155:28)\r\n   at wrappedQuery (C:\\sensorfact\\npm\\node_modules\\newrelic\\lib\\instrumentation\\mongodb.js:218:53)\r\n   at wrapped [as insert] (C:\\sensorfact\\npm\\node_modules\\newrelic\\lib\\instrumentation\\mongodb.js:188:22)\r\n   at NativeCollection.(anonymous function) [as insert] (C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\drivers\\node-mongodb-native\\collection.js:136:28)\r\n   at model.Model.$__handleSave (C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\model.js:130:21)\r\n   at model.Model.$__save (C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\model.js:189:9)\r\n   at C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\model.js:288:11\r\n   at new Promise.ES6 (C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\promise.js:45:3)\r\n   at model.Model.save (C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\model.js:287:10)\r\n   at model._done (C:\\sensorfact\\npm\\node_modules\\hooks-fixed\\hooks.js:101:24)\r\n   at _next (C:\\sensorfact\\npm\\node_modules\\hooks-fixed\\hooks.js:64:28)\r\n   at fnWrapper (C:\\sensorfact\\npm\\node_modules\\hooks-fixed\\hooks.js:186:18)\r\n   at model.Object.defineProperty.value.fn (C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\schema.js:250:9)\r\n   at _next (C:\\sensorfact\\npm\\node_modules\\hooks-fixed\\hooks.js:62:30)\r\n   at fnWrapper (C:\\sensorfact\\npm\\node_modules\\hooks-fixed\\hooks.js:186:18)\r\n   at model.<anonymous> (C:\\sensorfact\\npm\\node_modules\\mongoose\\lib\\schema.js:230:13)\r\n```\r\n\r\nHere are my mongoose dependencies.\r\n\r\n```\r\n│ ├─┬ mongoose@4.3.4\r\n│ │ ├── async@0.9.0\r\n│ │ ├── bson@0.4.19\r\n│ │ ├── hooks-fixed@1.1.0\r\n│ │ ├── kareem@1.0.1\r\n│ │ ├─┬ mongodb@2.1.2\r\n│ │ │ ├── es6-promise@3.0.2\r\n│ │ │ ├── UNMET PEER DEPENDENCY kerberos@~0.0\r\n│ │ │ ├─┬ mongodb-core@1.2.30\r\n│ │ │ │ └── bson@0.4.20\r\n│ │ │ └── readable-stream@1.0.31\r\n│ │ ├── mpath@0.1.1\r\n│ │ ├── mpromise@0.5.4\r\n│ │ ├─┬ mquery@1.6.3\r\n│ │ │ └── bluebird@2.9.26\r\n│ │ ├── ms@0.7.1\r\n│ │ ├── muri@1.0.0\r\n│ │ ├── regexp-clone@0.0.1\r\n│ │ └── sliced@0.0.5\r\n```\r\n\r\nAny ideas?"},"comment":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/comments/171786896","html_url":"https://github.com/Automattic/mongoose/issues/3752#issuecomment-171786896","issue_url":"https://api.github.com/repos/Automattic/mongoose/issues/3752","id":171786896,"user":{"login":"blyork","id":469793,"avatar_url":"https://avatars.githubusercontent.com/u/469793?v=3","gravatar_id":"","url":"https://api.github.com/users/blyork","html_url":"https://github.com/blyork","followers_url":"https://api.github.com/users/blyork/followers","following_url":"https://api.github.com/users/blyork/following{/other_user}","gists_url":"https://api.github.com/users/blyork/gists{/gist_id}","starred_url":"https://api.github.com/users/blyork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blyork/subscriptions","organizations_url":"https://api.github.com/users/blyork/orgs","repos_url":"https://api.github.com/users/blyork/repos","events_url":"https://api.github.com/users/blyork/events{/privacy}","received_events_url":"https://api.github.com/users/blyork/received_events","type":"User","site_admin":false},"created_at":"2016-01-14T21:34:45Z","updated_at":"2016-01-14T21:34:45Z","body":"I have gone back as mongoose 4.1 and I am still getting the error:\r\n\r\n```\r\n  ├─┬ mongoose@4.1.12\r\n  │ ├── async@0.9.0\r\n  │ ├── bson@0.4.21\r\n  │ ├── hooks-fixed@1.1.0\r\n  │ ├── kareem@1.0.1\r\n  │ ├─┬ mongodb@2.0.46\r\n  │ │ ├── es6-promise@2.1.1\r\n  │ │ ├─┬ mongodb-core@1.2.19\r\n  │ │ │ └─┬ kerberos@0.0.17\r\n  │ │ │   └── nan@2.0.9\r\n  │ │ └─┬ readable-stream@1.0.31\r\n  │ │   ├── core-util-is@1.0.2\r\n  │ │   ├── isarray@0.0.1\r\n  │ │   └── string_decoder@0.10.31\r\n  │ ├── mpath@0.1.1\r\n  │ ├── mpromise@0.5.4\r\n  │ ├─┬ mquery@1.6.3\r\n  │ │ └── bluebird@2.9.26\r\n  │ ├── ms@0.1.0\r\n  │ ├── muri@1.0.0\r\n  │ ├── regexp-clone@0.0.1\r\n  │ └── sliced@0.0.5\r\n```\r\n\r\n```\r\nTypeError: Cannot read property 'calculateObjectSize' of null\r\n   at addToOperationsList (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\mongodb\\lib\\bulk\\unordered.js:147:30)\r\n   at UnorderedBulkOperation.raw (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\mongodb\\lib\\bulk\\unordered.js:390:7)\r\n   at bulkWrite (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\mongodb\\lib\\collection.js:574:10)\r\n   at Collection.insertMany (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\mongodb\\lib\\collection.js:477:44)\r\n   at wrapped [as insertMany] (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\newrelic\\lib\\instrumentation\\mongodb.js:185:25)\r\n   at Collection.insert (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\mongodb\\lib\\collection.js:753:15)\r\n   at wrapped (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\newrelic\\lib\\transaction\\tracer\\index.js:155:28)\r\n   at wrappedQuery (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\newrelic\\lib\\instrumentation\\mongodb.js:218:53)\r\n   at wrapped [as insert] (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\newrelic\\lib\\instrumentation\\mongodb.js:188:22)\r\n   at NativeCollection.(anonymous function) [as insert] (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\mongoose\\lib\\drivers\\node-mongodb-native\\collection.js:142:28)\r\n   at model.Model.$__handleSave (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\mongoose\\lib\\model.js:118:21)\r\n   at C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\mongoose\\lib\\model.js:218:11\r\n   at new Promise.ES6 (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\mongoose\\lib\\promise.js:45:3)\r\n   at model.Model.save (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\mongoose\\lib\\model.js:217:10)\r\n   at model._done (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\hooks-fixed\\hooks.js:101:24)\r\n   at _next (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\hooks-fixed\\hooks.js:64:28)\r\n   at fnWrapper (C:\\sensorfact\\npm\\sensorfact-pclx-api\\node_modules\\hooks-fixed\\hooks.js:186:18)…\r\n```"}}