我不确定我是否在标题中使用了正确的术语,但这是我想从中检索数据的原始结果.
{ items:
[ { name: 'keydose',
keys: 69,
cid: 0,
$created': '2015-06-21T19:20:38.833Z',
' $updated': '2015-06-21T19:20:38.833Z' } ] }
Run Code Online (Sandbox Code Playgroud)
这是通过使用twitch-irc-db模块和node.js的twitch-irc库创建的,上面的输出通过以下方式接收:
db.where('users', {name: user.username}).then(function(result) {
console.log(result);
});
Run Code Online (Sandbox Code Playgroud)
我尝试使用console.log(result.items.cid),console.log(result.items.cid [0])和console.log(result.items.cid.valueOf())来获取cid的值从数据库,但我不知道还有什么可以尝试,我已经谷歌搜索很长一段时间,只是找不到任何东西.
谢谢你的时间 :)
我正在为我的公司开发一个应用程序,该应用程序利用带有 lambda 函数的 API 网关 REST 端点和 cognito 用户池(带有组)进行授权。
我昨天尝试添加一个新端点,收到了角色策略太大(超过 X 字节)的错误 - 在研究此问题后,我发现较新版本的 AWS amplify CLI(即 4.50.0)通过整合来规避此问题并结合类似的内联策略来减少总大小。
我升级到此版本的 Amplify CLI,发现这个问题已得到解决,但随后我遇到了另一个问题...在尝试通过 推送任何更改时amplify push,我现在收到以下错误:
Parameters: [unauthRoleName, authRoleName] do not exist in the template
这个错误指的是什么“模板”,我该如何解决它?在谷歌搜索后,我看到了一些潜在的解决方案,但没有一个真正对我有用,而对于那些确实有用的人来说,这只是一个临时解决方案。最终,如果我需要继续做一些事情作为临时修复,那么我会接受它并且它会做,但我想知道如何永久解决这个问题,因为我认为肯定缺少一些东西无论是在我这边还是在 AWS 云上...也许是升级 CLI 之前遇到的初始错误的产物?
感谢您的帮助,非常感谢:)
amazon-web-services aws-cloudformation amazon-cognito aws-lambda aws-amplify
我在代码中添加了一些注释,以便您可以看到问题所在,基本上......我希望在db.where()函数之后使用货币"可用",以便可以在if语句中使用它.毫无疑问,这很容易修复,但我很糟糕.感谢您的时间.
db.where('users', {name: user.username}).then(function(result) {
var currency = result.items[0].currency;
console.log(currency);
});
console.log("Program gets to this point without error.");
console.log(currency); // Doesn't work as currency is no longer defined.
if (typeof args[2] == 'number' && args[2] <= currency) {
var betOkay = true;
console.log("betOkay is " + betOkay);
}
Run Code Online (Sandbox Code Playgroud)