MichaelSolati / geofirestore-js

Location-based querying and filtering using Firebase Firestore.
https://geofirestore.com
MIT License
504 stars 58 forks source link

Invalid GeoFire key 'St.Louis': key cannot contain any of the following characters: . # $ ] [ / #67

Closed felixchan closed 5 years ago

felixchan commented 5 years ago

Hi,

Firestore allows the period as a document title. Is there a particular reason why this isn't allowed?

Any way I can change it? (tried to search validateKey but couldn't find the method in the repo)

MichaelSolati commented 5 years ago

So the reason for this is because the set function of geofirestore (v2.x.x) uses the batch function which has some constraints. This wont be changed/fixed in v2, but is addressed in v3 as you can do something like...

const geofirestore = new GeoFirestore(firebase.firestore());
const geocollection = geofirestore.collection('test');
const doc = geocollection.doc('St.Louis');
doc.set({
    coordinates: new firebase.firestore.GeoPoint(0, 0);
});