Note: I'm no expert at hibernate.
It seems like hibernate will try to reinsert a document if you mutate it at any point within a single entity managers lifetime. That means that from the time you persist an object, to calling em.close, you can not mutate that object.
The exception is a "com.mongodb.DuplicateKeyException"
After looking around a bit it looks to me like it's due to reusing the same "sharedTuple" without overwriting the tuple method, even after flushing the object. That means that the tuple keeps sicking around as an "INSERT" tuple, which gets reinserted into the action queue on update, causing a double insert. All other parts of the stack seem aware that it's actually a partial update, they just never change the method on the tuple.
I've attached a test class that demonstrates how it works and doesn't. I've tested it on OGM - 5.0.3.Final, where it seems to work fine. Please do note that it assumes a mongodb server running on localhost:27017, and the database "test" WILL BE DROPPED.