【问题标题】:Is there an issue in rxDB Query for an Array Element?rxDB 查询数组元素是否存在问题?
【发布时间】:2019-02-06 09:35:41
【问题描述】:

我正在尝试获取那些具有“someArray”的对象 - 数组和 someArray 对象之一“val” > 0 和“someKey” === 415

我在 rxdb 中使用 mongoDB 的链式方法,如 rxdb 文档中所述,但查询数组元素总是返回空数组,它不会给我任何错误。我正在使用 rxdb 版本 8.0.4。

 let localDB = await Database.get();
 let test = await localDB.testTable.find({ someArray: { $elemMatch: { 
    someKey: 415,  value: { $gt: 17 } } } 
    });
    const results = await test .exec().then(result=> {
        console.log("result  : ", result);
    });

预期的结果总是空数组,但在我的 localDB 中存在这种数据,100% 肯定。

【问题讨论】:

    标签: mongodb-query rxdb


    【解决方案1】:

    对于有类似问题的人,必须从模式中删除 keyCompression: true 并添加 pouchDB find 插件并使用 rxdb find not myCollection.pouch.find。 :)

    【讨论】:

      猜你喜欢
      • 2015-09-02
      • 1970-01-01
      • 2012-02-23
      • 2010-12-30
      • 1970-01-01
      • 1970-01-01
      • 2011-11-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多