2021.12.19报错解决:UnhandledPromiseRejectionWarning: MongoError: command find requires authentication

本文主要是介绍2021.12.19报错解决:UnhandledPromiseRejectionWarning: MongoError: command find requires authentication,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

解决思路:

1.查看报错原因,翻译后了解原因

UnhandledPromiseRejectionWarning: MongoError: command find requires authentication

2.通过百度查询查看相似问题,通过博客:https://blog.csdn.net/w_hx10/article/details/109538770
知道是因为之前设置过mongodb的权限,所以访问时需要添加一些设置
3.按照博客进行修改,问题解决
总结:认真查看别人写的博客,要耐下性子去看别人的博客(之前看过几遍这个人的博客,但是忽视了这个博客)
完整报错代码:

PS E:\vscode\alibaixiu\code\alibaixiu> node .\app.js
(node:18100) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:18100) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
(node:18100) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
(node:18100) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
服务器启动成功
数据库连接成功
(node:18100) UnhandledPromiseRejectionWarning: MongoError: command find requires authenticationat E:\vscode\alibaixiu\code\alibaixiu\node_modules\mongodb-core\lib\connection\pool.js:581:63at authenticateStragglers (E:\vscode\alibaixiu\code\alibaixiu\node_modules\mongodb-core\lib\connection\pool.js:504:16)at Connection.messageHandler (E:\vscode\alibaixiu\code\alibaixiu\node_modules\mongodb-core\lib\connection\pool.js:540:5)at emitMessageHandler (E:\vscode\alibaixiu\code\alibaixiu\node_modules\mongodb-core\lib\connection\connection.js:310:10)at Socket.<anonymous> (E:\vscode\alibaixiu\code\alibaixiu\node_modules\mongodb-core\lib\connection\connection.js:453:17)at Socket.emit (events.js:400:28)at addChunk (internal/streams/readable.js:290:12)at readableAddChunk (internal/streams/readable.js:265:9)at Socket.Readable.push (internal/streams/readable.js:204:10)at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
(node:18100) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:18100) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:18100) UnhandledPromiseRejectionWarning: MongoError: command find requires authenticationat E:\vscode\alibaixiu\code\alibaixiu\node_modules\mongodb-core\lib\connection\pool.js:581:63at authenticateStragglers (E:\vscode\alibaixiu\code\alibaixiu\node_modules\mongodb-core\lib\connection\pool.js:504:16)at Connection.messageHandler (E:\vscode\alibaixiu\code\alibaixiu\node_modules\mongodb-core\lib\connection\pool.js:540:5)at emitMessageHandler (E:\vscode\alibaixiu\code\alibaixiu\node_modules\mongodb-core\lib\connection\connection.js:310:10)at Socket.<anonymous> (E:\vscode\alibaixiu\code\alibaixiu\node_modules\mongodb-core\lib\connection\connection.js:453:17)at Socket.emit (events.js:400:28)at addChunk (internal/streams/readable.js:290:12)at readableAddChunk (internal/streams/readable.js:265:9)at Socket.Readable.push (internal/streams/readable.js:204:10)at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
(node:18100) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

这篇关于2021.12.19报错解决:UnhandledPromiseRejectionWarning: MongoError: command find requires authentication的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/406217

相关文章

Java NoClassDefFoundError运行时错误分析解决

《JavaNoClassDefFoundError运行时错误分析解决》在Java开发中,NoClassDefFoundError是一种常见的运行时错误,它通常表明Java虚拟机在尝试加载一个类时未能... 目录前言一、问题分析二、报错原因三、解决思路检查类路径配置检查依赖库检查类文件调试类加载器问题四、常见

电脑找不到mfc90u.dll文件怎么办? 系统报错mfc90u.dll丢失修复的5种方案

《电脑找不到mfc90u.dll文件怎么办?系统报错mfc90u.dll丢失修复的5种方案》在我们日常使用电脑的过程中,可能会遇到一些软件或系统错误,其中之一就是mfc90u.dll丢失,那么,mf... 在大部分情况下出现我们运行或安装软件,游戏出现提示丢失某些DLL文件或OCX文件的原因可能是原始安装包

电脑显示mfc100u.dll丢失怎么办?系统报错mfc90u.dll丢失5种修复方案

《电脑显示mfc100u.dll丢失怎么办?系统报错mfc90u.dll丢失5种修复方案》最近有不少兄弟反映,电脑突然弹出“mfc100u.dll已加载,但找不到入口点”的错误提示,导致一些程序无法正... 在计算机使用过程中,我们经常会遇到一些错误提示,其中最常见的就是“找不到指定的模块”或“缺少某个DL

解决IDEA报错:编码GBK的不可映射字符问题

《解决IDEA报错:编码GBK的不可映射字符问题》:本文主要介绍解决IDEA报错:编码GBK的不可映射字符问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录IDEA报错:编码GBK的不可映射字符终端软件问题描述原因分析解决方案方法1:将命令改为方法2:右下jav

MyBatis模糊查询报错:ParserException: not supported.pos 问题解决

《MyBatis模糊查询报错:ParserException:notsupported.pos问题解决》本文主要介绍了MyBatis模糊查询报错:ParserException:notsuppo... 目录问题描述问题根源错误SQL解析逻辑深层原因分析三种解决方案方案一:使用CONCAT函数(推荐)方案二:

IntelliJ IDEA 中配置 Spring MVC 环境的详细步骤及问题解决

《IntelliJIDEA中配置SpringMVC环境的详细步骤及问题解决》:本文主要介绍IntelliJIDEA中配置SpringMVC环境的详细步骤及问题解决,本文分步骤结合实例给大... 目录步骤 1:创建 Maven Web 项目步骤 2:添加 Spring MVC 依赖1、保存后执行2、将新的依赖

Spring 中的循环引用问题解决方法

《Spring中的循环引用问题解决方法》:本文主要介绍Spring中的循环引用问题解决方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录什么是循环引用?循环依赖三级缓存解决循环依赖二级缓存三级缓存本章来聊聊Spring 中的循环引用问题该如何解决。这里聊

Spring Boot中JSON数值溢出问题从报错到优雅解决办法

《SpringBoot中JSON数值溢出问题从报错到优雅解决办法》:本文主要介绍SpringBoot中JSON数值溢出问题从报错到优雅的解决办法,通过修改字段类型为Long、添加全局异常处理和... 目录一、问题背景:为什么我的接口突然报错了?二、为什么会发生这个错误?1. Java 数据类型的“容量”限制

关于MongoDB图片URL存储异常问题以及解决

《关于MongoDB图片URL存储异常问题以及解决》:本文主要介绍关于MongoDB图片URL存储异常问题以及解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录MongoDB图片URL存储异常问题项目场景问题描述原因分析解决方案预防措施js总结MongoDB图

SpringBoot项目中报错The field screenShot exceeds its maximum permitted size of 1048576 bytes.的问题及解决

《SpringBoot项目中报错ThefieldscreenShotexceedsitsmaximumpermittedsizeof1048576bytes.的问题及解决》这篇文章... 目录项目场景问题描述原因分析解决方案总结项目场景javascript提示:项目相关背景:项目场景:基于Spring