MongoDB 修改数据Cannot change the size of a document in a capped collection: * != *"

MongoDB修改数据库数据的时候报错

 

 

原因:

  集合被设置成了 固定集合 。固定集合的数据不能被修改。只能查找-删除-再插入,也就是创建集合的时候设置了capped参数为true

解决:

  创建集合的时候capped为false或者不写这个参数,默认为false

  

参考:

https://www.solidsyntax.be/2016/03/26/MongoDB-Cannot-change-the-size-of-a-document-in-a-capped-collection/

posted @ 2019-11-01 16:03  Arebirth  阅读(1770)  评论(0编辑  收藏  举报