db.serverStatus().connections dt.serverStatus().locks; rs.printReplicationInfo(); rs.printSlaveReplicationInfo(); rs.printSecondaryReplicationInfo();
db.currentOp({ “waitingForLock”: true });
db.setProfilingLevel(1, 50) db.system.profile.find().sort({ ts: -1 }).limit(5).pretty() db.mycollection.find({ field: value }).explain(“executionStats”)
mongostat –host 94.246.94.12:27017 -u ying -p dgfit59JWEM34 –authenticationDatabase admin mongotop –host 94.246.94.12:27017 -u ying -p dgfit59JWEM34 –authenticationDatabase admin
rs0:PRIMARY> rs.printSlaveReplicationInfo(); WARNING: printSlaveReplicationInfo is deprecated and may be removed in the next major release. Please use printSecondaryReplicationInfo instead. source: 94.246.94.9:27017 syncedTo: Tue Nov 26 2024 11:43:10 GMT+0100 (CET) 2 secs (0 hrs) behind the primary
###
mongosh --host 127.0.0.1 -u admin -p 123456 --authenticationDatabase admin
use hemnet;
db.createUser({
user: "hemnet",
pwd: "123456",
roles: [
{ role: "dbOwner", db: "hemnet" }
]
});
db.dropUser('hemnet')
# drop db
use wu;
db.dropDatabase();