【发布时间】:2022-11-21 19:03:36
【问题描述】:
我有一个可以为空值的字符串属性。我想将其设置为全球二级索引。但是当我尝试执行时它显示错误更新项目请求或者保存表语境:
Amazon.DynamoDBv2.AmazonDynamoDBException: One or more parameter values are not valid. A value specified for a secondary index key is not supported. The AttributeValue for a key attribute cannot contain an empty string value. IndexName: .... IndexKey: ...
我的心态或设置有什么问题?我是 DynamoDB 的新手并且有一个 MongoDB 基础。如果我不为此属性使用 GSI,如何对该属性执行查询?
我试过了
[DynamoDBIgnore] string property;
var operationConfig = new DynamoDBOperationConfig() { };
operationConfig.IsEmptyStringValueEnabled = true;
operationConfig.Conversion = DynamoDBEntryConversion.V2;
但它不起作用。
【问题讨论】:
-
你能分享一下你是如何创建表格的吗?
-
我创建了一个带有散列键的基表,并使用 .Net 中的对象持久性模型来保存/加载数据。
-
您可以发布执行此操作的代码吗?
标签: amazon-dynamodb