How to find index of a list in dynamodb?
<p>I am using Python's boto3 for Amazon's api and dynamodb.</p>

<p>I want to store id's of people who have liked a post. I am currently appending to that list when someone likes a post ( Each post has likedBy list ).
I am using <code>SET likedBy = list_append(likedBy, :v)</code> to add to the list when someone likes a post.
Ex: </p>

<pre><code>"likedBy" : [
    {
      "on": 1455736397,
      "userId": 232323
    },
    {
      "on": 1455736398,
      "userId": 46
    }]
</code></pre>

<p>But how do i <strong>remove that particular user from the list</strong> when they unlike again? And also i want to ensure that one user can only like a post only once? ( <strong>Ensure that userId in likedBy list is unique</strong>)</p>

<p>One solution i could think of was to get the whole list and check if list has <code>userId</code>, then find index and use AWS updateexpression <code>REMOVE likedBy[index]</code> to remove. ( i know this is not the correct way )</p>