撤消 convertToCapped 到集合 [英] Undo convertToCapped to a collection

查看:36
本文介绍了撤消 convertToCapped 到集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 MongoDB 中,您可以使用命令 convertToCapped 将集合转换为上限集合,但是有没有办法恢复此更改,以便上限集合恢复正常?

解决方案

似乎只有一种方法可以将上限集合转换为普通集合 - 只需简单地将对象复制到普通集合并删除原始上限集合.

<前><代码>db.createCollection("norm_coll");var cur = db.cap_col.find()而 (cur.hasNext()) {obj = cur.next();db.norm_coll.insert(obj);}

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 collection goes back to normal?

解决方案

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);}

这篇关于撤消 convertToCapped 到集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆