It's not possible to lock a mongodb document. What if I need to?

前端 未结 12 1676
死守一世寂寞
死守一世寂寞 2020-12-24 11:34

I know that I can\'t lock a single mongodb document, in fact there is no way to lock a collection either.

However, I\'ve got this scenario, where I think I need some

12条回答
  •  执念已碎
    2020-12-24 12:10

    If the order of the elements in the array is not important for you then the $push operator should be safe enough to prevent threads from overwriting each others changes.

提交回复
热议问题