1、文档的多条插入
db.class.insertMany([{
"name": "jack",
"age": 18,
"sex": 1,
"hobby": [
"画画",
"唱歌"
]
},{
"name": "kate",
"age": 15,
"sex": 0,
"hobby": [
"唱歌"
]
},{
"name": "jom",
"age": 25,
"sex": 1,
"hobby": [
"画画"
]
},{
"name": "lily",
"age": 17,
"sex": 0,
"hobby": [
"画画"
]
},{
"name": "mark",
"age": 18,
"sex": 0,
"hobby": [
"画画"
]
},{
"name": "frank",
"age": 19,
"sex": 0,
"hobby": [
"画画"
]
}])
2.查看年龄为18岁信息
3.查看年龄18-22岁信息
4.查看年龄17岁并喜欢画画的男生信息
5.查看年龄小于18岁或大于20岁的学生
6.找到班级中年龄最小的三位同学
class更新文档
1.将Kate兴趣爱好改为弹钢琴,足球
2.所有人年龄加一
3.替换jom内容:年龄为25,备注:{{民族:“回族”,习俗:“不吃猪肉”}}