mongoose报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead
参考:mongoose报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead
mongoose报错:(node:9716)DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead
解决方法:
// 导入第三方模块mongoose
const mongoose = require('mongoose'); // mongoose.set('useCreateIndex', true) //加上这个
// 或连接数据库时添加 useCreateIndex: true
mongoose.connect('mongodb://Jacey:123@localhost:27017/blog2', { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true }) .then(() => console.log('数据库链接成功')) .catch(err => console.log('数据库连接失败:', err));
mongoose报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead的更多相关文章
- mongoose报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
mongoose报错:(node:15689) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes ...
- mongoose 报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead
mongoose.set('useCreateIndex', true) // 加上这个
- [未解决]报错:DeprecationWarning: decodestring() is a deprecated alias since Python 3.1, use decodebytes()
DeprecationWarning: decodestring() is a deprecated alias since Python 3.1, use decodebytes()
- 【PHP】php7.2报错The each() function is deprecated. This message will be suppressed on furthe
php7.2以上 废除了 each()方法,项目中用到的地方会出现以下报错 The each() function is deprecated. This message will be suppre ...
- phpredis 报错 “Function Redis::setTimeout() is deprecated” 解决方法
项目在本地开发过程中抛出异常: Function Redis::setTimeout() is deprecated 找到出错代码: <?php use Illuminate\Support\F ...
- Vivado_HLS 编译报错error: AP_STREAM macros are deprecated
D:/vivado2018.3/Vivado/2018.3/common/technology/autopilot\ap_stream.h:62:2: error: AP_STREAM macros ...
- DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead extract-text-webpack-plugin 提取css报错
深入浅出Webpack 1-5 使用pulugin extract-text-webpack-plugin 提取css报错 DeprecationWarning: Tapable.plugin is ...
- mybatis报错Mapped Statements collection does not contain value for com.inter.IOper
首页 > 精品文库 > mybatis报错Mapped Statements collection does not contain value for com.inter.IOper m ...
- php报错日志:PHP Deprecated:Automatically populating $HTTP_RAW_POST_DATA is deprecated
前几天将线上php服务升级到5.6.x版本后,php-error.log报出错误:PHP Deprecated: Automatically populating $HTTP_RAW_POST_DAT ...
随机推荐
- 二进制方式搭建Kubernetes集群
环境准备: 演练暂时用单节点一台master和一台node节点来进行部署搭建(kubernetes 1.19版本) 角色 IP 组件 master 10.129.246.114 kube-apiser ...
- CTF文件包含
<?php include "flag.php"; $a = @$_REQUEST['hello']; eval( "var_dump($a);"); s ...
- C语言:数组数据交换
//交换数组中各个变量的值:第1和最后一个交换,第2与倒数第二个交换 #include <stdio.h> int main() { int a[]={1,2,3,4,5,6,7,8,9} ...
- 达梦数据库(DM8)大规模并行集群MPP 2节点安装部署
达梦数据库大规模并行集群MPP 2节点安装部署 1.环境准备 os 数据库版本 ip mpp角色 centos7.x86 DM8 192.168.30.100 mpp1 centos7.x86 ...
- UnitTest 用法
功能 1.能组织多个用例去执行 2.提供丰富的断言方法 3.提供丰富的日志与测试结果 核心要素 1.TestCase 2.TestSuite 3.TextTestRunner 4.Fixture 用法 ...
- XIN队算法
XIN队算法 注:名称由莫队算法改编而来 从luogu搬过来了... \(newly\;upd:2021.7.8\) \(newly\;upd:2021.6.6\) OI至高算法,只要XIN队算法打满 ...
- Volitle
缓存一致性协议 最出名的是Intel的MESI协议,该协议保证了每个缓存中使用的共享变量的副本是一致的.其思想是:当CPU写数据时,如果发现操作的变量是共享变量,即在其他CPU中也存在该变量的副本,会 ...
- SQL_之 递归_START WITH id ='102' CONNECT BY PRIOR pid=id
oracle 递归用法 SELECT * FROM menu START WITH id ='102' CONNECT BY PRIOR pid=id 一种应用 SELECT * FROM menu ...
- js 时间戳转为日期
1 function time(){ //页面时间戳转换成时间 2 $(".time").each(function(){ 3 var time = $(this).text(); ...
- 自学linux——16.LAMP项目上线流程
LAMP项目上线流程 一.编译安装与卸载Nginx(web服务器软件,类似于Apache) 1.安装nginx ① 下载nginx 网页下载https://nginx.org/en/downlo ...