当前位置:网站首页>Mongodb database replication table
Mongodb database replication table
2022-07-28 18:53:00 【Water and moon are clear and bright】
utilize foreach Method in shell Run directly inside
1, Copy the table of one instance to the table of another instance ( The same database )
db.collection_name.find().forEach(function(d){db.getSiblingDB('new_database')['collection_name'].insert(d);})
collection_name: Database table name
new_database: Target database
2, On the same host, the same db Next copy a table
db. Copy source table name .find().forEach(function(x){db. Destination table name .insert(x);})
Example :
db.test.find().forEach(function(x){db.test_bak.insert(x);})
边栏推荐
- MYSQL入门与进阶(九)
- Is it difficult for novices to change careers through self-study software testing?
- Docker builds MySQL master-slave replication
- Redis cache avalanche, penetration, breakdown, bloom filter, detailed explanation of distributed lock
- 2022-07-27 study notes of group 4 self-cultivation class (every day)
- kotlin:Nothing
- MYSQL入门与进阶(三)
- Ue5 gas learning notes 1.9 skill system global classes (abilitysystemglobals)
- 注意力机制及代码实现
- My creation anniversary -- July 25th, 2022
猜你喜欢

MYSQL入门与进阶(一)

Decimal to binary advanced version (can convert negative numbers and boundary values)

MYSQL入门与进阶(二)

@Autowired与@Resource区别

Docker builds MySQL master-slave replication

Go concurrency one

MYSQL入门与进阶(八)

使用自开发的代理服务器解决 SAP UI5 FileUploader 上传文件时遇到的跨域访问错误试读版

EasyCVR设备离线后无法再次上线该如何解决?

It is said that software testing is the worst in the IT industry. Is that so?
随机推荐
Redis advantages and data structure related knowledge
kotlin:Nothing
Error 2003 (HY000) can't connect to MySQL server on 'localhost3306' (10061) solution
Kotlin:sealed Class detailed explanation of sealed class
My creation anniversary -- July 25th, 2022
1.2、队列
UE4.25 Slate源码解读
Ue5 gas learning notes 1.7 task ability tasks
微信安装包11年膨胀575倍,UP主:“98%的文件是垃圾”;苹果应用商店被曝大量色情App;四大科技巨头呼吁废除闰秒|极客头条...
LeetCode_63_不同路径Ⅱ
Why app uses JSON protocol to interact with server: serialization related knowledge
APP为什么用JSON协议与服务端交互:序列化相关知识
Log base zap of go language series
Ue5 gas learning notes 1.9 skill system global classes (abilitysystemglobals)
2022.7.26 构造函数,面试:new的作用、深拷贝和浅拷贝
真正的 HTAP 对用户和开发者意味着什么?
1.1. Sparse array
C# 之 观察者模式实例 -- 订牛奶
Is the training institution of software testing reliable
三分钟了解快来新媒体