MongoDB常用的操作命令(国外英文资料).doc
文本预览下载声明
MongoDB常用的操作命令(国外英文资料)
Installation:
The official website /downloads
The mkdir c: \ data \ db
Xcopy d: \ mongodb-win32-1.8.1 c: C: \ mongodb - win32-1.8.1 \ bin mongod - dbpath c: \ data \ db
C: \ mongodb-win32-1.8.1 \ bin mongod - dbpath c: \ data -- log path c: \ data \ log.txt -- install -- serviceName mongodb
Net start mongo
The start http://localhost:28017
# uninstall mongo service
Mongod -- remove -- serviceName MongoDB
Enter the mongo:
Keep the mongod command window running, CMD to c: \ mongodb-win32-1.8.1 \ bin mongo
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Mongo order management
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Shell database operation
One, super user related:
# enter database admin
Use the admin
Adding or modifying user passwords
( name , PWD)
Check the list of users
The system. Users. The find ()
# user authentication
( name , PWD)
# deletes users
Db. RemoveUser ( name )
# view all users
Show users
Check all databases
Show DBS
Check all collections
Show the collections
Check the status of the collection
Db. PrintCollectionStats ()
Check the master slave copy status
Db. PrintReplicationInfo ()
# fix the database
Db. RepairDatabase ()
The # setting records profiling, 0 = off 1 = slow 2 = all
Db. SetProfilingLevel (1)
# 13. View the profiling
Show the profile
# 1 copy the database
CopyDatabase ( mail_addr , mail_addr_tmp)
15. # delete collection
Db. Mail_addr. Drop ()
Delete the current database
Db.dropdatabase ()
Second, increases the deletion
# stores nested objects
address : city : Beijing, post : 100096}, phone : [138,139]
# store the array object
User_addr.save ({ Uid : yushunzhi@ , Al : [ test 1@ ], test-2@]
# 3: chang
显示全部