2016-11-08 23 views

回答

0

以下解決方案使用AWS SDK DynamoDB其替代。目前,我認爲DynamoDB只有社區版本的Spring數據可用。因此,我提供了使用AWS SDK的解決方案。

QuerySpec Class

CONTAINS比較運算符可以用來搜索在LIST數據類型的值。

CONTAINS的支持列表:在評價 「A包含B」, 「A」 可以是一個列表;但是,「b」不能是集合,地圖或列表。

實施例: -

QuerySpec querySpec = new QuerySpec(); 
querySpec.withKeyConditionExpression("yearkey = :yearval and title = :title") 
       .withFilterExpression("contains (subscriptions, :subscriptions)") 
       .withValueMap(
         new ValueMap().withNumber(":yearval", yearKey) 
         .withString(":title", title) 
         .withString(":subscriptions", subscriptions)); 

編輯: -

目前,第二參數不能爲列表,因爲API不能處理它按照本說明書。解決方法是使用條件與多個CONTAINS。下面的例子: -

.withFilterExpression("contains (subscriptions, :subscriptions1) AND contains (subscriptions, :subscriptions2)") 
+0

在我的情況b也將是一個列表。我需要找到所有MongoDb的替代品。請建議。 –

+0

用解決方法更新了我的答案。 – notionquest

+0

感謝@notionquest –

相關問題