2012-02-09 69 views
3

在Mongodb中,您可以編寫包含對象甚至嵌套對象的多個屬性的查詢。 Oracle一致性是否支持這種複雜的查詢,還是簡單的K/V存儲?Oracle Coherence能否支持像MongoDb這樣的複雜查詢?

樣品的MongoDB查詢:

db.reports.find({profit:{$gt:99}, classification:'gas', name:/^USA/}) 

是否有可能做一致性類似的查詢?

回答

4

是的,您可以針對多個對象屬性(包含嵌套對象)查詢屬於單個緩存的條目
您可以使用Filter APICoherence Query Language來做到這一點。

通過過濾器表達上面的查詢會是這樣的:

reportsCache.entrySet(new AllFilter(new Filter[] { 
        new GreaterFilter("getProfit", 99), 
        new EqualsFilter("getClassification", "gas"), 
        new LikeFilter("getName", "USA%") 
      })); 

或使用CohQL:

select * from "reports" where profit > 99 and classification = "gas" and name like "USA%"