不粘锅的博客

MongoDB创建时间和更新时间的自动更新,以及存储格式问题

最近在写node服务时、遇到创建时间,更新时间每次变更都需要手动去触发更新,在网上搜了一些资料后,看到官网提供了2种方式来解决这个问题方案1以下为官网文档示例 , 我们只需要在new Schema时加一个参数即可const schema = Schema({ createdAt: Number,

管理员 发布于 2022-09-28

centos安装mongodb以及远程连接

安装本文章参考mongodb官网安装说明进行编写,参考地址:https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-red-hat/配置yum源创建文件/etc/yum.repos.d/mongodb-org-4.2.repo,

管理员 发布于 2022-09-25

Mongodb 报 because it is not in your schema. Set the `strictPopulate` option to false

背景今天使用mongodb的populate 方法做外键查询、抛出了路径不对的错误提示解决方案this.model.find().populate({ path: 'pageId', model: 'page', })其中pageId是我当前集合的外键Key、mod

管理员 发布于 2022-09-23