You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a table full of board games owned by my friends and details about them. The primary key for the table is a collection ID that is unique to each copy. There is also an objectId that correlates to the game, that is indexed.
Some versions of the same game have different names. For example, Carabande (a game where you flick disks around a racetrack) is also called PitchCar, but they share the same objectId -- they are two different names for the same game.
When I order the table by objectId, orderBy is quietly creating a collection that only has one document per objectId. A subsequent filter looks for a portion of a game title, and PitchCar is completely missing. It's not even in the collection to be found. orderBy selected the document for Carabande to represent that objectId.
I can order by the primary key as a workaround, but then I lose the ability to use eachUniqueKey later. I could write my own collection.each function that removes duplicates, but it feels like orderBy is doing more work than it should be.
The text was updated successfully, but these errors were encountered:
orderBy is basically iterating the index. But it sounds like the unique flag is set on the collection when you do the ordering. Try whether the call to eachUniqueKey() could be done on another collection instance to not affect the one you do orderBy on. I think the problem city could be the collection instance being reused
Interesting. Okay, I'll give it a try. I quickly implemented the workaround mentioned above, removing orderBy and writing my own de-duping function for collection.each(). But I'll check out using a different collection instance.
I have a table full of board games owned by my friends and details about them. The primary key for the table is a collection ID that is unique to each copy. There is also an objectId that correlates to the game, that is indexed.
Some versions of the same game have different names. For example, Carabande (a game where you flick disks around a racetrack) is also called PitchCar, but they share the same objectId -- they are two different names for the same game.
When I order the table by objectId,
orderBy
is quietly creating a collection that only has one document per objectId. A subsequentfilter
looks for a portion of a game title, and PitchCar is completely missing. It's not even in the collection to be found.orderBy
selected the document for Carabande to represent that objectId.I can order by the primary key as a workaround, but then I lose the ability to use
eachUniqueKey
later. I could write my owncollection.each
function that removes duplicates, but it feels likeorderBy
is doing more work than it should be.The text was updated successfully, but these errors were encountered: