1. Lock unlock
Db.runcommand ({fsync:1,lock:1})
Unlock
Db.currentop ()
2. Data Repair
Db.repairdatabase ()
3. Db.createuser ({User: "Uspcat", pwd: "123", Roles:[{role: "Useradminanydatabase", DB: "Admin"}]})
built-in Roles (built-in role): 1 . Database user role: Read, readWrite; 2 . Database Management roles: DbAdmin, Dbowner, useradmin; 3 . Cluster Management role: Clusteradmin, Clustermanager, Clustermonitor, Hostmanager; 4 5 6 . Super User role: root // There are also several roles that indirectly or directly provide access to System Superuser (Dbowner, Useradmin, useradminanydatabase) 7 . Internal role: __system
READ: Allows the user to read the specified database ReadWrite: Allows the user to read and write to the specified database dbadmin: Allows the user to execute administrative functions in the specified database, such as index creation, deletion, View statistics or Access System.profileuseradmin: Allows the user to write to the System.users collection and can create, delete, and manage user clusteradmin in the specified database: Only available in the admin database. Gives the user administrative privileges on all shards and replica set related functions. Readanydatabase: Only available in the Admin database, giving the user read access to all databases Readwriteanydatabase: Only available in the admin database, Give users read and write access to all databases Useradminanydatabase: Available only in the admin database, giving the user useradmin permissions to all databases Dbadminanydatabase: Only available in the admin database, Gives the user dbadmin permissions for all databases. Root: Available only in the admin database. Super account, Super privilege
4. Start the user
Db.auth ("Uspcat", "123") \
5. Delete a user
Db.system.users.remove ({User: "Uspcat"})
MongoDB system Knowledge (11)