【文件属性】:
文件名称:MongoDB的基础查询和索引操作方法总结
文件大小:63KB
文件格式:PDF
更新时间:2020-12-16 05:16:46
go mongodb mongodb命令
查询操作
1、查询所有记录
db.userInfo.find();
相当于:
select* from userInfo;
2、查询去掉后的当前聚集集合中的某列的重复数据
db.userInfo.distinct("name");
会过滤掉name中的相同数据
相当于:
select disttince name from userInfo;
3、查询age = 22的记录
db.userInfo.find({"age": 22});
相当于:
select * from userInfo where age = 22;
4、查询age > 22的记录
db.userI