db.集合名称.find() #查询所有
db.集合名称.find().pretty() #结构化显示
db.集合.find({name:10}).pretty() where name = 10
db.students.find({name:'juhao'}).pretty() where name = 'juhao'
db.集合.find({name:{$ne:10} }).pretty() where name != 10
db.集合.find({name:{$gt:10} }).pretty() where name > 10
db.集合.find({name:{$lt:10} }).pretty() where name < 10#后面加个e就是加等于#and逻辑
{$and:[{expression1}, {expression1}, ...] }
#or逻辑
{$or:[{expression1}, {expression1}, ...] }
#where sex='男' and age > 18
db.table.find({
$and:[
{sex:'男'}, {age:{$gt:18}}
]
})
#where sex='女' or age =18
db.table.find({
$or:[
{sex:'女'}, {age:18}
]
})
#where (sex='女' and age=18) or (sex='男' and age>18)
db.table.find({
$or:[
{$and:[{sex:'女'}, {age:18}]},
{$and:[{sex:'男'}, {age:{$gt:18}}]}
]
})