1.安装mongo客户端#
参考:ubuntu安装mongodb-4.4(通过apt命令)
2.连接mongodb#
1 | mongo ip:27017/db_name -u user_name -p |
3.创建collection#
参考:MongoDB 教程
1 | use xx_db |
4.插入数据#
insert one
1 | use xx_db |
insert many
1 | db.xx_collection.insertMany( |
5.删除数据#
delete one
1 | use xx_db |
delete many
1 | db.xx_collection.deleteMany({'token':'1111111'}) |
6.查看Mongo的collection大小#
1 | db.getCollection("your_collection").stats() |

7.查看collection是否是sharded#
1 | db.getCollection("your_collection").stats() |
没有sharded字段,或者sharded值为false,都不是sharded collection
