Ionic database collection findAll can return the same entry multiple times

I found an issue with IonicDB. Not exactly breaking, and there are plenty of workarounds, but this doesn’t seem like expected behavior. I would expect collection.findAll to return each match exactly once, regardless of whether it matches both conditions.

with an entry like

messages: [
{
user1: “123”,
user2: “123”
}
]

const chatMessages = this.db.collection("messages");
messages.findAll( {user1:user.$key} , {user2:user.$key} ).watch().subscribe(chats=>{
        console.log(_.uniqBy(chats,['id']) == chats);  //Logs false
}
1 Like