【发布时间】:2012-02-09 07:40:35
【问题描述】:
在 Mongodb 中,您可以编写包含对象的多个属性甚至嵌套对象的查询。 oracle coherence 是否支持如此复杂的查询,还是一个简单的 K/V 存储?
示例 Mongodb 查询:
db.reports.find({profit:{$gt:99}, classification:'gas', name:/^USA/})
是否可以对连贯性进行类似的查询?
【问题讨论】:
在 Mongodb 中,您可以编写包含对象的多个属性甚至嵌套对象的查询。 oracle coherence 是否支持如此复杂的查询,还是一个简单的 K/V 存储?
示例 Mongodb 查询:
db.reports.find({profit:{$gt:99}, classification:'gas', name:/^USA/})
是否可以对连贯性进行类似的查询?
【问题讨论】:
是的,您可以针对多个对象属性(包括嵌套对象)查询属于单个缓存的条目。
您可以使用Filter API 或Coherence 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%"
【讨论】: