db.py.find()// select * from py{"_id":ObjectId("5c886f51dda44c12743c3caa"),"model":"mate20","price":4988},
db.py.find({},{_id:0}})// select model,price from py// 查询结果不显示 _id 的域{"model":"mate20","price":4988},
db.py.find({},{_id:0,model:1}})// select model from py// 查询结果不显示 _id 的域 只显示 model 域{"model":"mate20"},
注意:如果给某个域设置为1,则其他自动为0,两者不能混用,_id域特殊
db.py.find({},{model:1,price:0})// 报错
2、 query参数
db.py.find({model:"mate20"},{_id:0})// select model,price from py where model="mate20" // 查询 model 为 mate20 的文档{"model":"mate20","price":4988},
db.py.find({model:"mate20",price:2888},{_id:0})// select model,price from py where model="mate20" and price=2888// 查询 model 为 mate20 且 price 为 2888 的文档{"model":"mate20","price":2888},