Amazon dynamodb DynamoDB(.net)中查询结果中属性的顺序是什么?
在.net中,我指定Amazon dynamodb DynamoDB(.net)中查询结果中属性的顺序是什么?,amazon-dynamodb,Amazon Dynamodb,在.net中,我指定 QueryOperationConfig queryConfig = new QueryOperationConfig { Filter = queryFilter, IndexName = "PARTNAME-NAME-index", Limit = 1, BackwardSearch = desc, Select = SelectValues.SpecificAttributes, AttributesToGet = new List<string>
QueryOperationConfig queryConfig = new QueryOperationConfig
{
Filter = queryFilter,
IndexName = "PARTNAME-NAME-index",
Limit = 1,
BackwardSearch = desc,
Select = SelectValues.SpecificAttributes,
AttributesToGet = new List<string>
{ "PARTNAME","ID", "NAME","WEIGHT" }
};
QueryOperationConfig queryConfig=新建QueryOperationConfig
{
过滤器=查询过滤器,
IndexName=“零件名称索引”,
极限=1,
BackwardSearch=desc,
Select=SelectValues.specifictattributes,
AttributesToGet=新列表
{“零件名”、“ID”、“名称”、“重量”}
};
但在查询结果中,属性的顺序是
重量、ID、零件名、名称
在我的表中,PARTNAME是Hashkey,ID是Sortkey,我有一个由PARTNAME和NAME组成的GSI PARTNAME索引
如何指定所需的属性顺序,
或者它们在默认情况下是如何排序的?首先,您使用的是遗留的
AttributesToGet
参数
这是一个遗留参数。改用ProjectionExpression
回答:-
DynamoDB不能保证结果中属性的顺序。DynamoDB主要是一个键值存储。您需要从结果中获取特定键的值
请注意,这与RDBMS上的SELECT语句不同。这是一个NoSQL数据库,它与RDBMS完全不同。我得到错误:QueryOperationConfig没有ProjectionExpressiones的定义,该类没有此参数。但是,类Amazon.DynamoDBv2.Model.QueryRequest类具有参数ProjectionExpression,并明确指出它是一个不推荐使用的参数。获取并设置属性AttributesToGet。这是一个遗留参数。改用ProjectionExpression。有关更多信息,请参阅Amazon DynamoDB Developer Guide.Ugh中的AttributesToGet,因为我知道QueryRequest应该像AmazondynamodClient.Query(QueryRequest)一样使用,现在我使用的是table.Query(QueryOperationConfig)。我所有的职能都应该改变。。。