后端报错:Cannot read property ‘phone‘ of null
后端报错:Cannot read property ‘phone’ of null
问题详情:![](/assets/blank.gif)
后端通过id查找数据库USERS表数据,命令行出现报错Cannot read property ‘phone’ of null。(result为ORDERS表中的数据,result[index].userId与USERS表中的_id一致。)
解决方案:
第一步:先输出data(console.log(data),判断是否在USERA表中查询到符合条件的数据。
发现命令行中有数据,并且data中有phone,但是数据中存在null。
第二步:在数据库可视化工具中查看,是否USERS表中包含所有的result[index].userId。![](/assets/blank.gif)
由于查询id是result[index].userId,所以在数据库可视化工具中查看,发现USERS表中缺少数据,可能是之前手动删除过。
总结:后端数据库查询,遇到问题多console.log()可以帮助我们找到问题所在。数据库查询出问题可以看看属性字段是否一致,数据库中数据是否缺失等等。
后端报错:Cannot read property ‘phone‘ of null相关推荐
- vue flv播放器报错Cannot read property ‘addEventListener‘ of null
业务场景:flv播放器,有创建dom和删除dom的操作,导致报错Cannot read property 'addEventListener' of null 原因是在动态切换播放链接时,flv组件是 ...
- vue中集成jsplumb报错`Cannot read property ‘parentNode‘ of null`,且无法渲染连线的问题
简介 我在项目中使用了typescript+vue+jsplumb作为流程图框架. 问题 我在容器中使用的是v-for指令渲染. 从配置文件中读取流程图的json并且存入this.items变量中 通 ...
- Angular12报错:Cannot read property _rawValidators of null
升级Angular12后报错:main.js:1 ERROR TypeError: Cannot read property '_rawValidators' of null 当前环境: Angula ...
- vue-i18n报错Cannot read property “_t” of null
问题: 使用i18n实现国际化功能,在切换语言状态时 ,js报错: TypeError: Cannot read property '_t' of null at VueComponent.Vue.$ ...
- element 时间日期选择器el-date-picker点击清空按钮报错 Cannot read property ‘0‘ of null
在使用DatePicker日期选择器选择日期范围的时候,会用到一个属性clearable.这个属性是Boolean变量,用于决定是否显示清除按钮,默认为true. <el-date-picker ...
- DateTimePicker 日期时间选择器报错 Cannot read property ‘getHours‘ of undefined, 无法选中`[__ob_: observer__]`时做判断
我在一次开发中遇到了这个情况:使用DateTimePicker 日期时间选择器,出现无法选中, 报错 Cannot read property 'getHours' of undefined, 这个原 ...
- vue 报错 Cannot read property ‘__ob__‘ of undefined的解决方法
vue 报错 Cannot read property '__ob__' of undefined的解决方法 参考文章: (1)vue 报错 Cannot read property '__ob__' ...
- 事件监听一直报错Cannot set property 'display' of undefined
为什么80%的码农都做不了架构师?>>> css ↓ .wechatBtn {position: relative;} .wechat {position: absolute; ...
- Vue开启Gzip打包异常:webpack打包报错Cannot read property ‘emit‘ of undefined
Vue开启Gzip打包异常:webpack打包报错Cannot read property 'emit' of undefined 相关代码 const CompressionPlugin = req ...
最新文章
- 中小学AI教育靠谱吗?50%教师教学经验不足1年
- 消息中间件的意义和应用场景 (activeMq)
- 关于计算机网络的好坏处的英语作文,网购的好处和坏处英语作文带翻译
- python 基础教程(第二版)
- [leetcode-54-Spiral Matrix]
- HeadFirst之设计模式 觀察者模式
- 形象解释 undefined 和 null 之间的区别 ​
- 数学建模——五步方法
- 科学家发现孤独感与大脑中的默认网络有关
- 喝王老吉可延长寿命大约10%?
- 微信、手Q、QQ浏览器userAgent记录
- 绝对干货丨最值钱的20个管理工具,会用一半的已年薪百万
- Flutter之路由与导航
- 对dpdk的rte_ring实现原理和代码分析
- android 西班牙_分析西班牙足球联赛(西甲)
- 黑白棋python代码框架_Python实现黑白棋人机对弈
- 剑指offter笔记
- 武大c语言网上作业答案,武大C语言题库
- 什么是服务器托管,企业为何选择服务器托管?
- 说一说我的java学习路途(记一个前端学习java日常)