首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >(find,findbyid,create)方法尚未设置回滚

(find,findbyid,create)方法尚未设置回滚
EN

Stack Overflow用户
提问于 2016-05-17 18:42:04
回答 1查看 1.8K关注 0票数 1

我正在尝试设置回送,到目前为止,我已经创建了一个到mysql的db连接,它是一个模型,现在正在使用api资源管理器来测试它,但是我在任何调用中都会收到这个错误:

代码语言:javascript
复制
"The find method has not been setup loopback. The PersistedModel has not been correctly attached to a DataSource!

以下是完整的答复:

代码语言:javascript
复制
{
  "error": {
    "name": "Error",
    "status": 500,
    "message": "Cannot call EaAssets.find(). The find method has not been setup. The PersistedModel has not been correctly attached to a DataSource!",
    "stack": "Error: Cannot call EaAssets.find(). The find method has not been setup. The PersistedModel has not been correctly attached to a DataSource!\n    at throwNotAttached (C:\\cmdb\\node_modules\\loopback\\lib\\persisted-model.js:62:11)\n    at Function.find (C:\\cmdb\\node_modules\\loopback\\lib\\persisted-model.js:210:5)\n    at SharedMethod.invoke (C:\\cmdb\\node_modules\\strong-remoting\\lib\\shared-method.js:252:25)\n    at HttpContext.invoke (C:\\cmdb\\node_modules\\strong-remoting\\lib\\http-context.js:384:12)\n    at phaseInvoke (C:\\cmdb\\node_modules\\strong-remoting\\lib\\remote-objects.js:645:9)\n    at runHandler (C:\\cmdb\\node_modules\\loopback-phase\\lib\\phase.js:135:5)\n    at iterate (C:\\cmdb\\node_modules\\async\\lib\\async.js:146:13)\n    at Object.async.eachSeries (C:\\cmdb\\node_modules\\async\\lib\\async.js:162:9)\n    at runHandlers (C:\\cmdb\\node_modules\\loopback-phase\\lib\\phase.js:144:13)\n    at iterate (C:\\cmdb\\node_modules\\async\\lib\\async.js:146:13)"
  }
}

这是我的模型-config.json

代码语言:javascript
复制
{
  "_meta": {
    "sources": [
      "loopback/common/models",
      "loopback/server/models",
      "../common/models",
      "./models"
    ],
    "mixins": [
      "loopback/common/mixins",
      "loopback/server/mixins",
      "../common/mixins",
      "./mixins"
    ]
  },
  "User": {
    "dataSource": "db"
  },
  "AccessToken": {
    "dataSource": "db",
    "public": false
  },
  "ACL": {
    "dataSource": "db",
    "public": false
  },
  "RoleMapping": {
    "dataSource": "db",
    "public": false
  },
  "Role": {
    "dataSource": "db",
    "public": false
  },
  "EaApplication": {
    "dataSource": "db",
    "public": true
  },
  "EaAssetCapabilityRelation": {
    "dataSource": "db",
    "public": true
  },
  "EaAssetTyp": {
    "dataSource": "db",
    "public": true
  },
  "EaAssetStatus": {
    "dataSource": "db",
    "public": true
  },
  "EaAssetLocation": {
    "dataSource": "db",
    "public": true
  },
  "EaAssetRelation": {
    "dataSource": "db",
    "public": true
  },
  "EaAssets": {
    "dataSource": null,
    "public": true,
    "$promise": {},
    "$resolved": true
  },
  "EaCapability": {
    "dataSource": "db",
    "public": true
  },
  "EaRelationType": {
    "dataSource": "db",
    "public": true
  },
  "EaServers": {
    "dataSource": "db",
    "public": true
  },
  "EaServices": {
    "dataSource": null,
    "public": true,
    "$promise": {},
    "$resolved": true
  },
  "EaBuildTyp": {
    "dataSource": "db",
    "public": true
  }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-05-17 18:59:32

您的EaAssets模型有一个null数据源,因此内置的远程方法不会被附加。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37283964

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档