The upsert command in mongo db is not allowing a custom id to be used when a new doc is inserted. For example, suppose a collection was created with all the docs having a custom id that is an auto-increment integer. Then, if an upsert is used, the developer is not able to specify an integer as the _id value to be inserted (if an insert is performed instead of an update).
This is breaking the upsert capability on any collection which uses custom ids, since once upserts are used in such a collection, the _id value of any docs inserted as a result of an upsert will use the ObjectId, instead of the custom id as on all other docs in the collection.
The fix would be to enable a $set command to be used in an upsert that specifies a value for _id, but the new _id value is only used if an insert is done instead of an update (since the _id value is immutable on existing docs).
See: http://groups.google.com/group/mongodb-user/browse_thread/thread/40fcaa617ab99873