Search code examples
mongodb-queryrxdb

Is there an issue in rxDB Query for an Array Element?


I am trying to get those objects which have "someArray" - array and one of someArray object "val" > 0 and "someKey" === 415

I am using mongoDBs' chained methods in rxDB, as mentiond in rxdb documentation, but query for an Array Element always returns empty array and it doesn't give me any error. I am using rxdb version 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);
    });

expected result is always empty array, but in my localDB exists those kind of data, 100% sure.


Solution

  • For people with similar issues, had to delete keyCompression: true from schema and add pouchDB find plugin and use rxdb find not myCollection.pouch.find. :)