Open sdandois opened 2 years ago
Hello @sdandois, thank you for the enhancement request. We tried to model Set
similar to a JavaScript Set. This uses size
to get the length of the data structure.
But I also understand your point that a Realm.Set
extends a Realm.Collection
and doesn't implement length
. We will consider this.
We believe the correct solution here is to fix the inheritance hierarchy for the collection types, so that Set only inherits relevant properties. We've created RJS-1751 to track this.
Problem
Realm.Set
extendsRealm.Collection
but doesn't implement the length property. It's true that you can access the size of a Set withsize
, but still this breaks the polymorphism contract with the parent class.Also, documentation is lacking in the reference: https://www.mongodb.com/docs/realm-sdks/js/latest/Realm.Set.html#length.
Solution
Option 1: Implement length just by delegating to size.
Option 2: Extend the documentation.
How important is this improvement for you?
I'd like to see it, but have a workaround