随笔分类 -  Mongoose

摘要:参考:https://www.cnblogs.com/LO-ME/p/10883032.html 阅读全文
posted @ 2021-01-20 14:53 半遮 阅读(103) 评论(0) 推荐(0) 编辑
摘要:./model/db.js // 引入mongoose const mongoose = require("mongoose"); //解决index索引引起的弃用提醒:(node:13616) DeprecationWarning: collection.ensureIndex is deprec 阅读全文
posted @ 2021-01-18 19:23 半遮 阅读(156) 评论(0) 推荐(0) 编辑
摘要:./model/db.js // 引入mongoose const mongoose = require("mongoose"); //解决index索引引起的弃用提醒:(node:13616) DeprecationWarning: collection.ensureIndex is deprec 阅读全文
posted @ 2021-01-18 12:49 半遮 阅读(367) 评论(0) 推荐(0) 编辑
摘要:Model.deleteMany() Model.deleteOne() Model.find() Model.findById() Model.findByIdAndDelete() Model.findByIdAndRemove() Model.findByIdAndUpdate() Model 阅读全文
posted @ 2021-01-17 23:46 半遮 阅读(134) 评论(0) 推荐(0) 编辑
摘要:./model/db.js // 引入mongoose const mongoose = require("mongoose"); //解决index索引引起的弃用提醒:(node:13616) DeprecationWarning: collection.ensureIndex is deprec 阅读全文
posted @ 2021-01-17 23:31 半遮 阅读(278) 评论(0) 推荐(0) 编辑
摘要:./model/user.js /* mongoose 的自定义修饰符: Getters 与 setters 除了mongoose内置修饰符以外,还可以通过 set (建议使用) 修饰符,对增加数据的时,对数据进行格式化; 也可以通过 get(不建议使用)在 实例获取数据 的时候 对 实例数据 进行 阅读全文
posted @ 2021-01-12 11:57 半遮 阅读(141) 评论(0) 推荐(0) 编辑
摘要:// mongoose 默认参数、 mongoose 模块化 、 mongoose 性能疑问 // mongoose 默认参数 :增加数据时候,如果不传入数据,会使用默认配置的数据 const mongoose = require("mongoose"); mongoose.connect("mon 阅读全文
posted @ 2021-01-07 16:52 半遮 阅读(176) 评论(0) 推荐(0) 编辑
摘要:mongoose01.js : /* mongoose 的使用: 1、npm 安装 mongoose : npm i mongoose --save ; 2、引入 mongoose 并连接数据库: const mongoose = require('mongoose'); mongoose.conn 阅读全文
posted @ 2021-01-06 14:56 半遮 阅读(275) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示