Continue the learning of MongoDB
1. Export data (interrupts other operations)
Export the Books collection from the database test
operate under the terminal
mongoexport-d test-c Books-o/home/hadoop/desktop/books.json
2. Import data (interrupt other operations)
Also operate under the terminal
Mongoimport--db Test--collection Books--file/home/hadoop/desktop/books.json
3. Run-time backup Mongodump
Operation under the terminal
Export the test database under 27017 of the 127.0.0.1 server
Mongodump--host 127.0.0.1:27017-d Test-o/home/hadoop/desktop/test
4. Run-time recovery Mongorestore
Operation under the terminal
Mongodump--host 127.0.0.1:27017-d Test-directoryperdb/home/hadoop/desktop/test/test
5. Lock operation
Db.runcommand ({fsync:1,lock:1})
6. Unlocking operation
Db.currentop ()
7. Data Repair
Db.repairdatabase ()
8. Add Users
Db.adduser ("Xiaoming", "123")
9. Delete a user
Db.system.users.remove ({User: "Xiaoming"})
MongoDB Learning Notes < seven >