DynamoDB: How to fetch single item where attribute value is not in a given list of values? -


i understand query might inefficient since can involve full table scan in worst case, need fetch single item @ time.

for example, have table containing values this:

{   id: 'bc63a25e-b92b-483e-9ad3-ad6d474dfae2',   domain: 'xyz.com',   template_url: `https://s3.us-east-2.amazonaws.com/bucket/some-random-url.html`,   data_elements: {     message_link: 'http://www.google.com'     zodiac_sign: 'scorpio'   } } 

i have gsi domain hash key. want fetch items table:

where domain == 'xyz.com'  , id not in <a list of ids> limit 1; 

how can achieve type of query ? checked documentation , see there in operator not find not in operator.

i had same issue, , don't think can. need use key 'get' method , 'scan' method. alternative (i think) fetch items , string comparison on each , everyone. don't think need mention how incredibly expensive be.

as mentioned, had deal same issue , ended changing data structure. bit cumbersome begin , have twice data entries of relational db negligible , query incredibly fast on micro aws instance.

you can't same operations on nosql db can on mysql db , prime example of that.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -