Click ( here) to collapse or open
- Use Demodb//using DEMODB, the following assumes the operation of collection is Foo
- Db.foo.remove ({"id": "123456"})//delete one piece of data
- Db.foo.remove ()//delete all records in Foo, but Foo still exists, show collection can also see Foo
- Db.foo.drop ()//delete Foo This collection, (Show collection Can't see Foo anymore) but the view data file discovery size is unchanged, MongoDB does not automatically free up file space
- Db.repairdatabase ()//After executing this command, MongoDB will release the space that is not needed
Db.repairdatabase () repair must stop reading and writing, and MongoDB to have a standby machine can, or do not use casually.
In the repair process if the abnormal MongoDB hangs, start again can not boot, need to repair, repair may take a long time.
Mongod--repair--dbpath=/var/lib/mongodb
Http://blog.chinaunix.net/uid-9162199-id-4160205.html
MongoDB drop does not free up disk space