mongodb 命令速查 Posted on 2020-03-19 | Edited on 2020-05-06 | In database mongodb 手册。 连接1mongo 192.168.1.200:27017/test -u user -p password db12345# 查看 dbshow dbs;# 使用 dbuse <db_name>; collection12# 查看 collectionsshow collections; 常用命令12345678# 创建唯一索引db.collection_name.ensureIndex({"key_name":1},{"unique":true})# 复合唯一索引db.collection_name.ensureIndex({'key1':1, 'key1':1})# 删除文档db.getCollection('domain').remove({"provison_state": "success", "industry": null})