查询专业不存在的学生信息,正确的命令是?
A: db.students.find({"major":null})
B: db.students.find({"major":{$in:[null],$exists:true}})
C: db.students.find({"major":{$exists:false}})
D: db.students.find({"major":{$exists:true}})
A: db.students.find({"major":null})
B: db.students.find({"major":{$in:[null],$exists:true}})
C: db.students.find({"major":{$exists:false}})
D: db.students.find({"major":{$exists:true}})
举一反三
- 查询软件开发专业成绩在80分(包含)以上的学生人数,正确的语句是? A: db.students.find({"major":"软件开发","score":{$gt:80}}).count() B: db.students.find({"major":"软件开发","score":{$gte:80}}).count() C: db.students.find({"major":"软件开发","score":{$gte:80}}) D: db.students.find({$or:[{"major":"软件开发"},{"score":{$gte:80}}]}).count()
- 删除软件技术专业和移动应用开发专业成绩在60以下的男生,正确的命令是? A: db.students.find({$and:[{$or:[{"major":"计算机应用"},{"major":"软件技术"}]},{"score":{$lt:60}}]}) B: db.students.find({{$or:[{"major":"计算机应用"},{"major":"软件技术"}]},{"score":{$lt:60}}}) C: db.students.remove({{$or:[{"major":"计算机应用"},{"major":"软件技术"}]},{"score":{$lt:60}}}) D: db.students.remove({$and:[{$or:[{"major":"计算机应用"},{"major":"软件技术"}]},{"score":{$lt:60}}]})
- 查询天心区的男学生的信息,正确的命令是? A: db.students.find({"address":"天心区"},{"sex":"男"}) B: db.students.find({"address":"天心区","sex":"男"}) C: db.students.find({$and:{"address":"天心区","sex":"男"}}) D: db.students.find({$and:[{"address":"天心区"},{"sex":"男"}]})
- 显示所有男生的信息,不正确的命令是? A: db.students.find({"sex":"男"}) B: db.students.find("this.sex=='男' ") C: db.students.find({"this.sex='男' "}) D: db.students.find({$where:"this.sex=='男' "})
- 查询成绩在60-80之间的学生信息,正确的语句是? A: db.students.find({"score":{$gte:60,$lte:80}}) B: db.students.find({"score":{$gte:80},{"score":{$lte:60}}}) C: db.students.find({"score":{$gte:60},{"score":{$te:80}}}) D: db.students.find({"score":{$gt:80},{"score":{$lt:60}}})