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?
Answer
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.
No comments:
Post a Comment