How can we assign one field value to another?

I want to assign one field value (existing field) to another field (new one) inside embedded (means array if hashes). In short I wanna create new key-value pair, where key is static but value is another field’s value.

Welcome to the MongoDB Community @Dhara_Pathak!

To help us provide relevant advice, please comment with:

  • an example document before & after the change you want to make

  • your version of MongoDB server

You may find Formatting code and log snippets in posts tips handy for improving readability.

Thanks,
Stennie

1 Like