摘要: 参考:https://www.cnblogs.com/LO-ME/p/10883032.html 阅读全文
posted @ 2021-01-20 14:53 半遮 阅读(108) 评论(0) 推荐(0)
摘要: // ES6 回顾: // 1、模板字符串 /* var name = "张三"; var age = 20; console.log(name + "已经" + age + "岁了!"); //常规的拼接写法 console.log(`${name}已经${age}岁啦`);//ES6的模板字符串 阅读全文
posted @ 2021-01-20 13:27 半遮 阅读(64) 评论(0) 推荐(0)
摘要: ./model/db.js // 引入mongoose const mongoose = require("mongoose"); //解决index索引引起的弃用提醒:(node:13616) DeprecationWarning: collection.ensureIndex is deprec 阅读全文
posted @ 2021-01-18 19:23 半遮 阅读(189) 评论(0) 推荐(0)
摘要: ./model/db.js // 引入mongoose const mongoose = require("mongoose"); //解决index索引引起的弃用提醒:(node:13616) DeprecationWarning: collection.ensureIndex is deprec 阅读全文
posted @ 2021-01-18 12:49 半遮 阅读(377) 评论(0) 推荐(0)
摘要: Model.deleteMany() Model.deleteOne() Model.find() Model.findById() Model.findByIdAndDelete() Model.findByIdAndRemove() Model.findByIdAndUpdate() Model 阅读全文
posted @ 2021-01-17 23:46 半遮 阅读(140) 评论(0) 推荐(0)
摘要: ./model/db.js // 引入mongoose const mongoose = require("mongoose"); //解决index索引引起的弃用提醒:(node:13616) DeprecationWarning: collection.ensureIndex is deprec 阅读全文
posted @ 2021-01-17 23:31 半遮 阅读(302) 评论(0) 推荐(0)
摘要: // es5 function person() { console.log("1:pe1"); //实例化一次就会执行一遍该函数, this.run = function () { //实例方法,需要实例化后才能通过实例化对象来调用 console.log("2:run"); console.lo 阅读全文
posted @ 2021-01-17 22:48 半遮 阅读(274) 评论(0) 推荐(0)
摘要: ./model/user.js /* mongoose 的自定义修饰符: Getters 与 setters 除了mongoose内置修饰符以外,还可以通过 set (建议使用) 修饰符,对增加数据的时,对数据进行格式化; 也可以通过 get(不建议使用)在 实例获取数据 的时候 对 实例数据 进行 阅读全文
posted @ 2021-01-12 11:57 半遮 阅读(153) 评论(0) 推荐(0)
摘要: // mongoose 默认参数、 mongoose 模块化 、 mongoose 性能疑问 // mongoose 默认参数 :增加数据时候,如果不传入数据,会使用默认配置的数据 const mongoose = require("mongoose"); mongoose.connect("mon 阅读全文
posted @ 2021-01-07 16:52 半遮 阅读(193) 评论(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 半遮 阅读(296) 评论(0) 推荐(0)