{"action":"closed","issue":{"url":"https://api.github.com/repos/meteor/meteor/issues/2278","labels_url":"https://api.github.com/repos/meteor/meteor/issues/2278/labels{/name}","comments_url":"https://api.github.com/repos/meteor/meteor/issues/2278/comments","events_url":"https://api.github.com/repos/meteor/meteor/issues/2278/events","html_url":"https://github.com/meteor/meteor/issues/2278","id":37277148,"number":2278,"title":"Upsert in bundled app - MongoError: The _id field cannot be changed","user":{"login":"ianhorst","id":1136686,"avatar_url":"https://avatars.githubusercontent.com/u/1136686?v=3","gravatar_id":"","url":"https://api.github.com/users/ianhorst","html_url":"https://github.com/ianhorst","followers_url":"https://api.github.com/users/ianhorst/followers","following_url":"https://api.github.com/users/ianhorst/following{/other_user}","gists_url":"https://api.github.com/users/ianhorst/gists{/gist_id}","starred_url":"https://api.github.com/users/ianhorst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianhorst/subscriptions","organizations_url":"https://api.github.com/users/ianhorst/orgs","repos_url":"https://api.github.com/users/ianhorst/repos","events_url":"https://api.github.com/users/ianhorst/events{/privacy}","received_events_url":"https://api.github.com/users/ianhorst/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/meteor/meteor/labels/Project:Mongo%20Driver","name":"Project:Mongo Driver","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2014-07-07T15:03:52Z","updated_at":"2015-02-06T19:13:19Z","closed_at":"2015-02-06T19:13:19Z","body":"App built with \"meteor bundle\" fails with \"Exception while invoking method 'saveDoc' MongoError: The _id field cannot be changed from {_id: \"5SWzAFjndCKZxn42b\"} to {_id: \"KkQ5JmFKwSHqffLoa\"}\" when upserting full document. Works fine when not bundled.\r\n\r\nCode sample to replicate:\r\ngit clone https://github.com/ianhorst/meteor-bundled-upsert-bug.git\r\n\r\nError:\r\n```\r\nException while invoking method 'saveDoc' MongoError: The _id field cannot be changed from {_id: \"5SWzAFjndCKZxn42b\"} to {_id: \"KkQ5JmFKwSHqffLoa\"}.\r\nat Object.Future.wait (/Users/user/study/bundle/programs/server/node_modules/fibers/future.js:326:15)\r\nat null.<anonymous> (packages/meteor/helpers.js:111)\r\nat MongoConnection.(anonymous function) [as update] (packages/mongo-livedata/mongo_driver.js:607)\r\nat Meteor.Collection.(anonymous function) [as update] (packages/mongo-livedata/collection.js:476)\r\nat Meteor.Collection.upsert (packages/mongo-livedata/collection.js:501)\r\nat Meteor.methods.saveDoc (app/idFail.js:15:19)\r\nat maybeAuditArgumentChecks (packages/livedata/livedata_server.js:1487)\r\nat packages/livedata/livedata_server.js:643\r\nat _.extend.withValue (packages/meteor/dynamics_nodejs.js:56)\r\nat packages/livedata/livedata_server.js:642\r\n- - - - -\r\n  at Object.toError (/Users/user/study/bundle/programs/server/npm/mongo-livedata/main/node_modules/mongodb/lib/mongodb/utils.js:110:11)\r\nat /Users/user/study/bundle/programs/server/npm/mongo-livedata/main/node_modules/mongodb/lib/mongodb/collection/core.js:542:27\r\nat /Users/user/study/bundle/programs/server/npm/mongo-livedata/main/node_modules/mongodb/lib/mongodb/db.js:1129:7\r\nat /Users/user/study/bundle/programs/server/npm/mongo-livedata/main/node_modules/mongodb/lib/mongodb/db.js:1843:9\r\nat Server.Base._callHandler (/Users/user/study/bundle/programs/server/npm/mongo-livedata/main/node_modules/mongodb/lib/mongodb/connection/base.js:445:41)\r\nat /Users/user/study/bundle/programs/server/npm/mongo-livedata/main/node_modules/mongodb/lib/mongodb/connection/server.js:468:18\r\nat MongoReply.parseBody (/Users/user/study/bundle/programs/server/npm/mongo-livedata/main/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)\r\nat null.<anonymous> (/Users/user/study/bundle/programs/server/npm/mongo-livedata/main/node_modules/mongodb/lib/mongodb/connection/server.js:426:20)\r\nat emit (events.js:95:17)\r\nat null.<anonymous> (/Users/user/study/bundle/programs/server/npm/mongo-livedata/main/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:201:13)\r\n```"}}