3

在 Mongodb 中,您可以编写包含对象的多个属性甚至嵌套对象的查询。oracle coherence 是否支持如此复杂的查询,还是一个简单的 K/V 存储?

示例 MongoDB 查询:

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

是否可以对连贯性进行类似的查询?

4

1 回答 1

4

是的,您可以针对多个对象属性(包括嵌套对象)查询属于单个缓存的条目。
您可以使用过滤器 APICoherence 查询语言来做到这一点。

通过过滤器表达的上述查询将类似于:

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%"
于 2012-02-10T10:00:49.860 回答