的AWS SimpleDB documentation爲Ruby SDK提供下面的例子是關於使用get_attributes
方法:如何檢測SimpleDB域是否包含請求的項目?
resp = client.get_attributes({
domain_name: "String", # required
item_name: "String", # required
attribute_names: ["String"],
consistent_read: false,
})
...,然後將下面的示例響應:
resp.attributes #=> Array
resp.attributes[0].name #=> String
resp.attributes[0].alternate_name_encoding #=> String
resp.attributes[0].value #=> String
resp.attributes[0].alternate_value_encoding #=> String
它還指出以下的一段建議:
如果在該操作所訪問的副本上不存在該項目,則會返回一個空集斯內德。系統不會返回錯誤,因爲它無法保證該項目不存在於其他副本上。
我希望我誤解這一點,但如果你的反應不會返回一個空集,那麼怎麼是你應該知道,如果是因爲沒有項目與所提供的項名稱存在,或者如果您的要求只是打一個不包含你的物品的複製品?