Reputation: 993
I am retrieving a list from Firestore and checking if it contains a particular string. This list can have thousands of entries. But I have found out the HashSet.contains is much faster than List.contains (sometimes up to 20 times faster). So I'm trying to find out if a HashSet can be saved to Firestore so that searching through the set is faster than searching through a list if it were a list.
From research, I have found that Firestore supports particular data types. I know that Firestore supports Maps and that HashSet uses Maps internally. So does this mean that HashSet is a supported data type?
https://firebase.google.com/docs/firestore/manage-data/data-types
Upvotes: 2
Views: 730
Reputation: 138999
So I'm trying to find out if a HashSet can be saved to Firestore
As specified in the official documentation regarding data types:
A HashSet
is not a supported data type.
So does this mean that HashSet is a supported data type?
It doesn't. There is no way you can save a HashSet
as a property in a document. You can save it as a Map
or as an array
and then convert it to a HashSet
on the client.
Upvotes: 2