{"action":"opened","number":1345,"pull_request":{"url":"https://api.github.com/repos/mongodb/node-mongodb-native/pulls/1345","id":59583323,"html_url":"https://github.com/mongodb/node-mongodb-native/pull/1345","diff_url":"https://github.com/mongodb/node-mongodb-native/pull/1345.diff","patch_url":"https://github.com/mongodb/node-mongodb-native/pull/1345.patch","issue_url":"https://api.github.com/repos/mongodb/node-mongodb-native/issues/1345","number":1345,"state":"open","locked":false,"title":"Added error catching in bulkWrite function for bulk.raw","user":{"login":"TimothyGu","id":1538624,"avatar_url":"https://avatars.githubusercontent.com/u/1538624?v=3","gravatar_id":"","url":"https://api.github.com/users/TimothyGu","html_url":"https://github.com/TimothyGu","followers_url":"https://api.github.com/users/TimothyGu/followers","following_url":"https://api.github.com/users/TimothyGu/following{/other_user}","gists_url":"https://api.github.com/users/TimothyGu/gists{/gist_id}","starred_url":"https://api.github.com/users/TimothyGu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimothyGu/subscriptions","organizations_url":"https://api.github.com/users/TimothyGu/orgs","repos_url":"https://api.github.com/users/TimothyGu/repos","events_url":"https://api.github.com/users/TimothyGu/events{/privacy}","received_events_url":"https://api.github.com/users/TimothyGu/received_events","type":"User","site_admin":false},"body":"When an error is thrown from `OrderedBulkOperation#raw` or `UnorderedBulkOperation#raw` (such as the document greater than maximum size error), it was not caught properly, and therefore not propagated correctly through callbacks.\r\n\r\nTest case:\r\n\r\n```js\r\nvar MongoClient = require('mongodb').MongoClient;\r\n\r\n// Connection URL\r\nvar url = 'mongodb://localhost/test';\r\n// Use connect method to connect to the Server\r\nMongoClient.connect(url, function(err, db) {\r\n  console.log(\"Connected correctly to server\");\r\n\r\n  var col = db.collection('testcol');\r\n  col.insert({\r\n    blob: new Buffer(20 * 1024 * 1024)\r\n  }, function (err) {\r\n    console.log('callback');\r\n    console.log(err);\r\n\r\n    db.close();\r\n  });\r\n});\r\n```\r\n\r\nBefore:\r\n\r\n```\r\n$ node test\r\nConnected correctly to server\r\n\r\nnode_modules/mongodb/lib/mongo_client.js:465\r\n          throw err\r\n          ^\r\nMongoError: document is larger than the maximum size 16777216\r\n    at Function.MongoError.create (node_modules/mongodb-core/lib/error.js:31:11)\r\n    at toError (node_modules/mongodb/lib/utils.js:114:22)\r\n    at addToOperationsList (node_modules/mongodb/lib/bulk/ordered.js:154:51)\r\n    at OrderedBulkOperation.raw (node_modules/mongodb/lib/bulk/ordered.js:342:7)\r\n    at bulkWrite (node_modules/mongodb/lib/collection.js:591:10)\r\n    at Collection.insertMany (node_modules/mongodb/lib/collection.js:490:44)\r\n    at Collection.insert (node_modules/mongodb/lib/collection.js:773:15)\r\n    at test.js:10:7\r\n    at node_modules/mongodb/lib/mongo_client.js:462:11\r\n    at nextTickCallbackWith0Args (node.js:419:9)\r\n```\r\n\r\nAfter:\r\n\r\n```\r\n$ node test\r\nConnected correctly to server\r\ncallback\r\n{ [MongoError: document is larger than the maximum size 16777216]\r\n  name: 'MongoError',\r\n  message: 'document is larger than the maximum size 16777216',\r\n  driver: true }\r\n```\r\n\r\nSystem info:\r\n\r\n```sh\r\n$ node -p 'process.versions'\r\n{ http_parser: '2.5.1',\r\n  node: '4.3.0',\r\n  v8: '4.5.103.35',\r\n  uv: '1.8.0',\r\n  zlib: '1.2.8',\r\n  ares: '1.10.1-DEV',\r\n  icu: '56.1',\r\n  modules: '46',\r\n  openssl: '1.0.2f' }\r\n$ node -p 'require(\"mongodb/package\").version'\r\n2.1.6\r\n$ lsb_release -a\r\nNo LSB modules are available.\r\nDistributor ID: Ubuntu\r\nDescription:    Ubuntu 12.04.5 LTS\r\nRelease:        12.04\r\nCodename:       precise\r\n$ mongod --version\r\ndb version v3.2.1\r\ngit version: a14d55980c2cdc565d4704a7e3ad37e4e535c1b2\r\nOpenSSL version: OpenSSL 1.0.1 14 Mar 2012\r\nallocator: tcmalloc\r\nmodules: none\r\nbuild environment:\r\n    distmod: ubuntu1204\r\n    distarch: x86_64\r\n    target_arch: x86_64\r\n```","created_at":"2016-02-17T01:28:02Z","updated_at":"2016-02-17T01:28:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mongodb/node-mongodb-native/pulls/1345/commits","review_comments_url":"https://api.github.com/repos/mongodb/node-mongodb-native/pulls/1345/comments","review_comment_url":"https://api.github.com/repos/mongodb/node-mongodb-native/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mongodb/node-mongodb-native/issues/1345/comments","statuses_url":"https://api.github.com/repos/mongodb/node-mongodb-native/statuses/06fd4db11d7d1b312136b63cd70ba4ce3a720023","head":{"label":"TimothyGu:patch-1","ref":"patch-1","sha":"06fd4db11d7d1b312136b63cd70ba4ce3a720023","user":{"login":"TimothyGu","id":1538624,"avatar_url":"https://avatars.githubusercontent.com/u/1538624?v=3","gravatar_id":"","url":"https://api.github.com/users/TimothyGu","html_url":"https://github.com/TimothyGu","followers_url":"https://api.github.com/users/TimothyGu/followers","following_url":"https://api.github.com/users/TimothyGu/following{/other_user}","gists_url":"https://api.github.com/users/TimothyGu/gists{/gist_id}","starred_url":"https://api.github.com/users/TimothyGu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimothyGu/subscriptions","organizations_url":"https://api.github.com/users/TimothyGu/orgs","repos_url":"https://api.github.com/users/TimothyGu/repos","events_url":"https://api.github.com/users/TimothyGu/events{/privacy}","received_events_url":"https://api.github.com/users/TimothyGu/received_events","type":"User","site_admin":false},"repo":{"id":51883335,"name":"node-mongodb-native","full_name":"TimothyGu/node-mongodb-native","owner":{"login":"TimothyGu","id":1538624,"avatar_url":"https://avatars.githubusercontent.com/u/1538624?v=3","gravatar_id":"","url":"https://api.github.com/users/TimothyGu","html_url":"https://github.com/TimothyGu","followers_url":"https://api.github.com/users/TimothyGu/followers","following_url":"https://api.github.com/users/TimothyGu/following{/other_user}","gists_url":"https://api.github.com/users/TimothyGu/gists{/gist_id}","starred_url":"https://api.github.com/users/TimothyGu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimothyGu/subscriptions","organizations_url":"https://api.github.com/users/TimothyGu/orgs","repos_url":"https://api.github.com/users/TimothyGu/repos","events_url":"https://api.github.com/users/TimothyGu/events{/privacy}","received_events_url":"https://api.github.com/users/TimothyGu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TimothyGu/node-mongodb-native","description":"Mongo DB Native NodeJS Driver","fork":true,"url":"https://api.github.com/repos/TimothyGu/node-mongodb-native","forks_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/forks","keys_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/teams","hooks_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/hooks","issue_events_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/issues/events{/number}","events_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/events","assignees_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/assignees{/user}","branches_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/branches{/branch}","tags_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/tags","blobs_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/statuses/{sha}","languages_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/languages","stargazers_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/stargazers","contributors_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/contributors","subscribers_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/subscribers","subscription_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/subscription","commits_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/contents/{+path}","compare_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/merges","archive_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/downloads","issues_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/issues{/number}","pulls_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/pulls{/number}","milestones_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/milestones{/number}","notifications_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/labels{/name}","releases_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/releases{/id}","deployments_url":"https://api.github.com/repos/TimothyGu/node-mongodb-native/deployments","created_at":"2016-02-17T01:07:55Z","updated_at":"2016-02-17T01:07:57Z","pushed_at":"2016-02-17T01:10:33Z","git_url":"git://github.com/TimothyGu/node-mongodb-native.git","ssh_url":"git@github.com:TimothyGu/node-mongodb-native.git","clone_url":"https://github.com/TimothyGu/node-mongodb-native.git","svn_url":"https://github.com/TimothyGu/node-mongodb-native","homepage":"http://mongodb.github.com/node-mongodb-native/","size":77657,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"2.1"}},"base":{"label":"mongodb:2.1","ref":"2.1","sha":"9b22d39590ca8a28ac43be789d14a0fdaa50c5c1","user":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"repo":{"id":462292,"name":"node-mongodb-native","full_name":"mongodb/node-mongodb-native","owner":{"login":"mongodb","id":45120,"avatar_url":"https://avatars.githubusercontent.com/u/45120?v=3","gravatar_id":"","url":"https://api.github.com/users/mongodb","html_url":"https://github.com/mongodb","followers_url":"https://api.github.com/users/mongodb/followers","following_url":"https://api.github.com/users/mongodb/following{/other_user}","gists_url":"https://api.github.com/users/mongodb/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb/subscriptions","organizations_url":"https://api.github.com/users/mongodb/orgs","repos_url":"https://api.github.com/users/mongodb/repos","events_url":"https://api.github.com/users/mongodb/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mongodb/node-mongodb-native","description":"Mongo DB Native NodeJS Driver","fork":false,"url":"https://api.github.com/repos/mongodb/node-mongodb-native","forks_url":"https://api.github.com/repos/mongodb/node-mongodb-native/forks","keys_url":"https://api.github.com/repos/mongodb/node-mongodb-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mongodb/node-mongodb-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mongodb/node-mongodb-native/teams","hooks_url":"https://api.github.com/repos/mongodb/node-mongodb-native/hooks","issue_events_url":"https://api.github.com/repos/mongodb/node-mongodb-native/issues/events{/number}","events_url":"https://api.github.com/repos/mongodb/node-mongodb-native/events","assignees_url":"https://api.github.com/repos/mongodb/node-mongodb-native/assignees{/user}","branches_url":"https://api.github.com/repos/mongodb/node-mongodb-native/branches{/branch}","tags_url":"https://api.github.com/repos/mongodb/node-mongodb-native/tags","blobs_url":"https://api.github.com/repos/mongodb/node-mongodb-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mongodb/node-mongodb-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mongodb/node-mongodb-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/mongodb/node-mongodb-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mongodb/node-mongodb-native/statuses/{sha}","languages_url":"https://api.github.com/repos/mongodb/node-mongodb-native/languages","stargazers_url":"https://api.github.com/repos/mongodb/node-mongodb-native/stargazers","contributors_url":"https://api.github.com/repos/mongodb/node-mongodb-native/contributors","subscribers_url":"https://api.github.com/repos/mongodb/node-mongodb-native/subscribers","subscription_url":"https://api.github.com/repos/mongodb/node-mongodb-native/subscription","commits_url":"https://api.github.com/repos/mongodb/node-mongodb-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/mongodb/node-mongodb-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/mongodb/node-mongodb-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/mongodb/node-mongodb-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/mongodb/node-mongodb-native/contents/{+path}","compare_url":"https://api.github.com/repos/mongodb/node-mongodb-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mongodb/node-mongodb-native/merges","archive_url":"https://api.github.com/repos/mongodb/node-mongodb-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mongodb/node-mongodb-native/downloads","issues_url":"https://api.github.com/repos/mongodb/node-mongodb-native/issues{/number}","pulls_url":"https://api.github.com/repos/mongodb/node-mongodb-native/pulls{/number}","milestones_url":"https://api.github.com/repos/mongodb/node-mongodb-native/milestones{/number}","notifications_url":"https://api.github.com/repos/mongodb/node-mongodb-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mongodb/node-mongodb-native/labels{/name}","releases_url":"https://api.github.com/repos/mongodb/node-mongodb-native/releases{/id}","deployments_url":"https://api.github.com/repos/mongodb/node-mongodb-native/deployments","created_at":"2010-01-07T12:50:50Z","updated_at":"2016-02-16T23:56:02Z","pushed_at":"2016-02-16T18:50:29Z","git_url":"git://github.com/mongodb/node-mongodb-native.git","ssh_url":"git@github.com:mongodb/node-mongodb-native.git","clone_url":"https://github.com/mongodb/node-mongodb-native.git","svn_url":"https://github.com/mongodb/node-mongodb-native","homepage":"http://mongodb.github.com/node-mongodb-native/","size":78925,"stargazers_count":4481,"watchers_count":4481,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":970,"mirror_url":null,"open_issues_count":11,"forks":970,"open_issues":11,"watchers":4481,"default_branch":"2.1"}},"_links":{"self":{"href":"https://api.github.com/repos/mongodb/node-mongodb-native/pulls/1345"},"html":{"href":"https://github.com/mongodb/node-mongodb-native/pull/1345"},"issue":{"href":"https://api.github.com/repos/mongodb/node-mongodb-native/issues/1345"},"comments":{"href":"https://api.github.com/repos/mongodb/node-mongodb-native/issues/1345/comments"},"review_comments":{"href":"https://api.github.com/repos/mongodb/node-mongodb-native/pulls/1345/comments"},"review_comment":{"href":"https://api.github.com/repos/mongodb/node-mongodb-native/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mongodb/node-mongodb-native/pulls/1345/commits"},"statuses":{"href":"https://api.github.com/repos/mongodb/node-mongodb-native/statuses/06fd4db11d7d1b312136b63cd70ba4ce3a720023"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":6,"deletions":2,"changed_files":1}}