一、连接mongo

mongo 127.0.0.1:27016 -u "mongotest" -p --authenticationDatabase "testDB"

二、基本操作

1、show dbs; #查看所有库
2、use test1; #选中某库和mysql use一样
3、show collections; #查看所有的表
4、db.getCollection('test_table').find({"city": "成都"}); #查询
5、db.getCollection("test_table").find({"rent_type": "整租"}, {"lng": 1,"lat": 1}); #查询
6、db.getCollection("test_table").distinct("city"); # 去除

三、索引操作

参考:https://www.cnblogs.com/williamjie/p/9297670.html