Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does mongodb clean up a large amount of data in collection

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how mongodb cleans up a large amount of data in collection, I believe most people don't know much about it, so share this article for your reference. I hope you can learn a lot after reading this article. Let's learn about it together.

1 for Loop cleanup in shell

Connect to mongo every time to perform remove operation of data

Echo "Begin..." > > / root/time.log;echo $(date +% Y-%m-%d-%H:%M:%S) > > / root/time.log;for ((item1witi > / root/tickets.logdoneecho $(date +% Y-%m-%d-%H:%M:%S) > > / root/time.log;echo "End." > > / root/time.log;echo "> > / root/time.log

2 for cycle cleaning in mongo shell

Connect mongo only once, and for loop cleaning in mongo shell

[root@mongo ~] # more t.shecho "Begin..." > > / root/t.log;echo $(date +% Y-%m-%d-%H:%M:%S) > > / root/t.log;/usr/local/mongodb/bin/mongo 127.0.0.1:37017/test-uadmin-padmin t.jsX echo $(date +% Y-%m-%d-%H:%M:%S) > > / root/t.log;echo "End." > > / root/t.log Echo "" > > / root/t.log [root@mongo ~] # [root@mongo ~] # [root@mongo ~] # more t.jsfor (var iTunes 1; I

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report