|
show databases
|
Show all databases
|
|
use <database>
|
Select a database for usage
|
|
show collections
|
Show all collections in a database
|
|
db
|
Shortcut to the currently used database
|
|
db.<collection>.remove()
|
Truncate (empty) a collection
|
db.<collection>.update({
storeID: ObjectId("<id_here>")
},
{
$set: {
storeID: ObjectId("<id_here>")
}
},
{
multi: true
})
|
db.copyDatabase('old_name', 'new_name');
|
Copy the database to a new database
|
|
use <old_name>
|
Switch to the database you wish to delete
|
|
db.dropDatabase();
|
Destroys the selected database
|
|
mongodump -d <database_name> -o <directory_backup> -h <host> --port <port> -u <user> -p
|
|
mongorestore <directior_backup>
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.