Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 表达式中提供的值表达式中未使用的属性名称:键:{loan}_Node.js_Amazon Dynamodb_Dynamodb Queries - Fatal编程技术网

Node.js 表达式中提供的值表达式中未使用的属性名称:键:{loan}

Node.js 表达式中提供的值表达式中未使用的属性名称:键:{loan},node.js,amazon-dynamodb,dynamodb-queries,Node.js,Amazon Dynamodb,Dynamodb Queries,我试图查询一个资产项目,并仅在它是借出的情况下对其进行筛选。如果贷款属性不存在或为空,则认为资产未贷款。通过CLI查询项目可以按预期工作。但是,documentClient.query()抛出错误: NodeJS: documentClient.query({ TableName: "Asset", ProjectionExpression: "id", KeyConditionExpression: "#id = :id"

我试图查询一个资产项目,并仅在它是借出的情况下对其进行筛选。如果贷款属性不存在或为空,则认为资产未贷款。通过CLI查询项目可以按预期工作。但是,documentClient.query()抛出错误:

NodeJS:

documentClient.query({
  TableName: "Asset",
  ProjectionExpression: "id",
  KeyConditionExpression: "#id = :id",
  ExpressionAttributeNames: {
      "#id": "id",
      "#loan": "loan"
  },
  ExpressionAttributeValues: {
      ":id": "8b8ea8f5-196f-440c-aff3-87ab66eb9669",
      ":null": null
  },
  FilterExpresssion: "attribute_exists(#loan) and #loan <> :null"
}, (err, data) => {
  if (err) {
    console.error(err); // ---> error thrown
  } else {
    console.log(data);
  }
});

ValidationException: Value provided in ExpressionAttributeNames unused in expressions: keys: {#loan}

你试过这种方法吗

ExpressionAttributeValues = { ":null", new AttributeValue { NULL = true } }

干杯你试过这种方法吗

ExpressionAttributeValues = { ":null", new AttributeValue { NULL = true } }
干杯

ExpressionAttributeValues = { ":null", new AttributeValue { NULL = true } }