loopback - “无法读取未定义的属性‘应用’”?在环回 3
问题描述
我不知道为什么当我在环回资源管理器中执行该方法时出现此错误给出了错误 This is the .js file used in the project
'use strict';
module.exports = function(Puntoventa) {
var app = require('../../server/server');
Puntoventa.getAll = function() {
Puntoventa.find({ where: { nombre: !null } }, function(err, punto) {
if (err) return callback(err);
return punto;
});
}
}
这是模型 .json
"name": "puntoVenta",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"acls": [],
"methods": {
"getAll": {
"accepts": [],
"returns": [{
"arg": "punto",
"type": "object",
"root": true,
}],
"http": [{
"path": "/getAll",
"verb": "get"
}]
}
}
解决方案
该错误是由于 sql 查询中的错误,您不能使用 !null 而是可以使用 loopback 给出的 neq
Puntoventa.find({ where: { nombre: { "neq": null} } }, function(err, punto) {
if (err) return callback(err);
return punto;
});
推荐阅读
- javascript - 如何使用 threex dom 事件为 Threejs Mesh 对象添加事件监听器?
- c++ - CMakeLists.txt的安装功能中.cmake文件有什么用?
- reactjs - 尽管值是新的,但 useEffect setData 未设置数据
- python - Flask - CSS 源文件混淆
- shell - 在 shell 中每 100 个逗号后添加“换行符”
- azure-devops - Azure DevOps NuGet 任务刚开始失败(缺少 dotnet 核心)
- database - Firestore 数据结构从朋友和朋友的朋友那里获取项目
- python - 具有相似字符串部分保持索引和序列的两个数据帧的匹配序列
- java - 为每个检查的异常回滚的事务注释 - 使用 AspectJ
- notepad++ - 在 Powershell 中检查当前安装的 Notepad++ 版本