当使用findByIdAndUpdate方法和runValidators时,您观察到的行为在Mongoose中是预期的:真正的选择。默认情况...
now } }); const Course = mongoose.model('Course', courseSchema); async function updateCourse(id) { const course = await Course.findById(id); if (!course) { console.log('Course does not exist with the given ID'); return; } course.isPublished = true; course.author = 'Another Author'...
Configuration: Mongoose 4.0.5, MongoDb 3.0.4, Node 0.12.4 Issue does not appear on Mongoose 3.8.30 My database has the following data: db.users.find() { "_id" : ObjectId("5580c79aa11e7310b2985ab1"), "email" : "an_email", "color" : "", "u...