【问题标题】:Can Oracle Coherence support complex queries like MongoDb?Oracle Coherence 能否支持像 MongoDb 这样的复杂查询?
【发布时间】: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


    【解决方案1】:

    是的,您可以针对多个对象属性(包括嵌套对象)查询属于单个缓存的条目。
    您可以使用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%"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-18
      • 1970-01-01
      • 2011-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-06
      相关资源
      最近更新 更多