I was hoping you would provide some more details so that I could see
what you were doing.
The error message you are getting occurs when your code attempts to
change the value of an _id of an existing document in the database,
which is not allowed.
I can think of at least two ways this might be happening:
1. Explicitly changing the value with Set:
var query = Query.EQ("_id", oldValue);
var update = Update.Set("_id", newValue);
var result = collection.Update(query, update);
2. Implicitly changing the _id value while updating the entire
document:
var document = ...; // fetched from outside MongoDB and assigned a
new random _id
var query = ...; // some query that doesn't involve _id
var update = Update.Replace(document);
var result = collection.Update(query, update, UpdateFlags.Upsert);
In this second case you would be attempting to replace an entire
document with a new one that has a different _id value.
Does either of these cases match your code?