Updating a document field in mongo based on another field's value

mongodb

Solution

No, you can't do that. You can't use expressions in mongodb updates. The only way is to fetch this document to the client, compose new field value there and issue a prepared update statement.

Problem

Suppose I have two fields F1 and F2. I want to update F1 to become `F1 + ", " + F2`. Can I do so with a single update command in mongo?

Original source

Related problems