Undo convertToCapped to a collection

后端 未结 3 1749
暖寄归人
暖寄归人 2021-01-12 21:18

In MongoDB you can convert a collection into a capped collection with the command convertToCapped, but is there a way to revert this change so a capped collecti

3条回答
  •  甜味超标
    2021-01-12 22:12

    It's seems there is only one way to convert from capped collection to normal - just simple copy objects to normal collection and remove original capped collection.

    
    db.createCollection("norm_coll");
    var cur = db.cap_col.find()
    while (cur.hasNext()) {obj = cur.next(); db.norm_coll.insert(obj);}
    
    

提交回复
热议问题