Open
Description
Hi all,
I've seen a couple questions around the web asking about writing queries with multiple criteria, rather than just location-based queries. For example, maybe I want all users that are within 15 miles AND are in college AND are male AND are under 20. I know there's no built-in way to do this, but I suggested a workaround here.
If that seems like a reasonable workaround, maybe it would be a nice addition to the library? You could use an obscure unicode character as the delimiter, and do something like:
geoFire
.compoundKey('my/geofire/ref')
.addKey('user_key')
.addKey('in_college')
.addKey('gender')
.addKey('age');
.setLocation('whatever')
Then, once retrieved from the query, you could do
geoFireKey.split(), which would return something like
{
user_key: 1234567890,
in_college: true,
gender: female,
age: 19
}
Maybe it could even have a filtering function that you set,
geoQuery.setFilterFunction(function(compoundKey) {
if (compoundKey.in_college === true &&
compoundKey.gender === 'female' &&
compoundKey.age === 19) {
return true;
}
return false;
})
Thoughts?