- 最新
- 投票最多
- 评论最多
You simply create a GlobalSecondaryIndex (GSI) on CompanyCode
in which you group the data by that field. For every CompanyCode
that the admin is allowed to view, you must issue a Query. For example, if they were allowed to see 10 companies orders, you would make 10 concurrent requests to the GSI.
You can read about best practices for using indexes here
Looks like you need an index on "company codes" attribute, but will be easier to answer if you post the current table structure with some sample data.
@carlos Thanks you for your response,
I currently have an index for the Company Code in my DynamoDB dataset. Consider the sample data provided. I've implemented a solution for Admin A, who has access to Company#5100, to retrieve the data in a single query.
Now, I'm dealing with Admin B, who has access to both Company#5100 and Company#7100. Instead of querying data for both companies separately and concatenating the responses, I'm seeking a more efficient approach. What could be a better strategy to handle this scenario for Admin B with access to multiple companies?
相关内容
- AWS 官方已更新 10 个月前
- AWS 官方已更新 2 年前
- AWS 官方已更新 2 年前
- AWS 官方已更新 10 个月前
@carlos Unable to include an image in the comment, I've posted a new answer. Please refer to my message below for the details.
https://repost.aws/questions/QULBw-s2wMTPqACOokGLxbdQ/filtering-aws-dynamodb-orders-by-users-s-accessible-company-codes#ANTUS1MB5dSOuq44QDO3AuZA