Append a string to the end of an existing field in MongoDB

后端 未结 6 1295
灰色年华
灰色年华 2020-12-02 23:22

I have a document with a field containing a very long string. I need to concatenate another string to the end of the string already contained in the field.

The way I

6条回答
  •  再見小時候
    2020-12-03 00:08

    This would not be possible. One optimization you can do is create batches of updates. i.e. fetch 10K documents, append relevant strings to each of their keys, and then save them as single batch. Most mongodb drivers support batch operations.

提交回复
热议问题