MongoDB增删改查
**
User.find().then(result=>{
console.log(result)
})
**
User.find({name:'李四'}).then(result=>{
console.log(result)
})
**
User.find({hobbies:{$in:['足球']}}).then(result=>{
console.log(result)
})
**
User.find({age:{$gt:20,$lt:50}}).then(result=>{
console.log(result)
})
User.find().select('name email -id').then(result=>{
console.log(result)
})
User.find().sort('age').then(result=>{
console.log(result)
})
User.find().sort('-age').then(result=>{
console.log(result)
})
User.find().skip(2).limit(3).then(result=>{
console.log(result)
})
User.findOneAndDelete({name:'张三'}).then(result=>{
console.log(result)
});
User.DeleteMany().then(result=>{
console.log(result)
});
User.updateOne({ name: '李四' }, { name: '李狗蛋' }).then(result => {
console.log(result);
});
User.updateMany({}, { age: 56 }).then(result => {
console.log(result);
})