我花了几个小时的时间来显示更新文档的最终值(通过猫鼬updateOne)。当我调用Postman上的端点时,我成功地修改了它,因为我可以看到"nModified: 1“,但是我无法输出实际的最终文档--即使使用参数{new:true}// 3.We found the block, so we modify it { _id: req.params.blockid
',companyMotto, '-', //close the db }); 我正在尝试找出一个代码来更新整个集合,如果他们的集合已经存在,使用 // create a collection and inserting the object
dbo.collection('employees').updateOnesubDom
我有一个user模式,当我向数据库中添加一个新的模式时,它会在pre(save)钩子中散列password,但是我想在更新时这样做,但是它保存了普通密码,而不是散列密码。 this.set('password', hashedPassword);});UserSchema.pre('updateOnePassword.hash(this.get('password'));
this