当前位置:网站首页>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);})
边栏推荐
- Pyqt5 rapid development and practice 5.3 multithreading
- EasyCVR设备离线后无法再次上线该如何解决?
- N32替换STM32,这些细节别忽略!
- What skills do you need to master when learning software testing zero foundation?
- 历史上的今天:微软收购 QDOS;模型检测先驱出生;第一张激光照排的中文报纸...
- 1.2、队列
- Go concurrency one
- 湖上建仓全解析:如何打造湖仓一体数据平台 | DEEPNOVA技术荟系列公开课第四期
- redis优势以及数据结构相关知识
- Differences between RDB and AOF for redis persistence
猜你喜欢

SwiftUI 组件之如何实现电话号码掩码隐藏部分的文本字段TextField(教程含源码)

零知识证明:具有DDH假设的 ZKP

UE4.25 Slate源码解读

1.3 linked list

Use the self-developed proxy server to solve the cross domain access errors encountered when uploading files by SAP ui5 fileuploader trial version

N32替换STM32,这些细节别忽略!

AI has changed thousands of industries. How can developers devote themselves to the new "sound" state of AI voice

Example of observer mode of C -- ordering milk

Introduction and advanced level of MySQL (5)

微信安装包11年膨胀575倍,UP主:“98%的文件是垃圾”;苹果应用商店被曝大量色情App;四大科技巨头呼吁废除闰秒|极客头条...
随机推荐
Go concurrency one
11 年膨胀 575 倍,微信为何从“小而美”变成了“大而肥”?
MYSQL入门与进阶(二)
[actual combat] realize page distortion correction with OpenCV
Four years later, Debian finally recaptured the "debian.community" domain name!
Cause analysis and solution of video jam after easycvr is connected to the device
112. Use the self-developed proxy server to solve the cross domain access error encountered when uploading files by SAP ui5 fileuploader
2022.7.26 constructor, interview: the role of new, deep copy and shallow copy
Redis cache avalanche, penetration, breakdown, bloom filter, detailed explanation of distributed lock
2022年中国企业服务产业市场行情
kotlin:out in
PyQt5快速开发与实战 5.3 多线程
GC垃圾回收器详解
微信安装包11年膨胀575倍,UP主:“98%的文件是垃圾”;苹果应用商店被曝大量色情App;四大科技巨头呼吁废除闰秒|极客头条...
Ue5 gas learning notes 1.7 task ability tasks
Pyqt5 rapid development and practice 5.3 multithreading
Kotlin:Sealed class密封类详解
Kotlin:sealed Class detailed explanation of sealed class
Example of observer mode of C -- ordering milk
十进制转二进制进阶版(可转化负数以及边界值)