Updated reference serialization for MongoDB