How to update Username whenever I Update My First Name or Last Name


My Username aka Name field is a combination of first name and last name. My Username field should be updated whenever I update my first name or last name.

Can someone help me to solve this issue? I’ll be grateful if you can help me to solve this issue in MongoDB/morphia.

Thanks in advance

Hi @Abishan_Parameswaran,

Sounds like it’s a job for Change Streams or their equivalent in the cloud: Realm Database Triggers.

Filter on the updatedFields to make sure firstname or lastname are updated and then send an updateOne command for each match.