mongodb常用查询和操作命令
db.system.users.find()db.users.count()db.users.ensureIndex({password:-1})use testdb.users.getIndexes()db.repairDatabase() show usersshow dbsdb.users.find({username:{$in:['4d81a82398790']}}).explain()db.users.dropIndexes() db.users.find().count()db.users.find().limit(5)db.users.find({"username":"ssa"}) show collections db.users.remove()db.user.remove({'username':'admin'})db.user.insert({'username':'admin','age':21,'nickname':'admin'})db.user.save({'username':'admin','age':21,'info':['12','12313','zzsd']})db.createCollection("user") db.dropDatabase() show collections db.test.drop() db.copyDatabase('test','test1')show profiledb.printCollectionStats()db.addUser('admin','admin123') db.setProfilingLevel(2);db.setProfilingLevel( 1 , 10 );db.system.profile.find()