随笔分类 - mongoose/mongodb
摘要:需要对 id 进行转换 const mongoose = require('mongoose') var ObjectId = mongoose.Types.ObjectId; await Users.aggregate([ { $match : { "_id":new ObjectId("5asd
阅读全文
摘要:一、使用 mongodump 命令备份数据 mongodump -h IP --port 端口 -u 用户名 -p 密码 -d 数据库 -c 表 -o 文件存放路径 参数说明: -h 指明数据库宿主机的IP --port 指明数据库的端口 -u 指明数据库的用户名 -p 指明数据库的密码 -d 指明
阅读全文
摘要:1,博客表结构 Blog.js var mongoose = require('mongoose') mongoose.connect('mongodb://localhost/test',{ useUnifiedTopology: true , useNewUrlParser: true}); v
阅读全文
摘要:date:{ type: String, default: () => moment(new Date()).format('YYYY-MM-DD HH:mm:ss'), } date:{ type: String, default: () => moment(new Date()).format(
阅读全文