1. const mongoose = require('mongoose');
    2. mongoose.connect( 'mongodb://127.0.0.1:27017/eggcms', {useNewUrlParser: true});
    3. var UserSchema =new mongoose.Schema({
    4. name:String,
    5. age:Number
    6. })
    7. var User = mongoose.model('User',UserSchema,'user')
    8. User.updateOne({name:"李四"},{name:"chengchao"},(err,doc)=>{
    9. if(err) throw err;
    10. console.log(doc)
    11. })