java - How to apply the search in list type field in dynamodb? -


we using $all in mongodb repository below:

@query(value = "{ 'subscriptions' : {$all : ?0 }}")  public list<contentitem> findbysubscription(string[] subscriptioncode); 

it works mongo need alternative in dynamodb

the below solution uses aws sdk dynamodb. currently, think there community version of spring data available dynamodb. so, have provided solution using aws sdk.

queryspec class

the contains comparison operator can used search values in list data type.

contains supported lists: when evaluating "a contains b", "a" can list; however, "b" cannot set, map, or list.

example:-

queryspec queryspec = new queryspec(); queryspec.withkeyconditionexpression("yearkey = :yearval , title = :title")                 .withfilterexpression("contains (subscriptions, :subscriptions)")                 .withvaluemap(                         new valuemap().withnumber(":yearval", yearkey)                         .withstring(":title", title)                          .withstring(":subscriptions", subscriptions)); 

edit:-

currently, second parameter can't list because api can't process per specification. workaround use and condition multiple contains. example below:-

.withfilterexpression("contains (subscriptions, :subscriptions1) , contains (subscriptions, :subscriptions2)") 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -