skip to Main Content

I’m trying to design a GSI for my table which contains a lot of data. However I know that its best practice to only project data that I need instead of the entire thing. Projecting data is pretty straight forward when it comes to Top-Level entities but in my use case I also need to project some of the contents of a map object

To give you more detail, here is my partial schema –

Name,
id,
url,
stats {
    revenue: {
        revenue: 123,
        total_orders: 123,
    }
    social: {}
    
}

and I want to project name, url and total_orders. Is there a way of projecting all three without projecting the whole stats object ?

2

Answers


  1. Sorry, no. You can only specify by name(s) what attribute to project.

    Login or Signup to reply.
  2. Only top level attributes can be projected. So for your case you would have 2 possible options:

    1. Project the entire stats map if it’s not extremely large

    2. Write total_orders as a top level attribute. This would cause duplication but it would be negligible.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search