unable to add url string of firestorage to firestore
Clash Royale CLAN TAG#URR8PPP
unable to add url string of firestorage to firestore
I'm having issues adding data to firestore. I can upload my data with no problem if the URL reference from firestorage isn't in the data set. I've even uploaded blank document to firestore with no problem. I was able to upload the data about 3 months ago and now it won't work.
dbRef = firebase.firestore().collection('Collection');
const inputInfo = new GeoFirestore(dbRef);
inputInfo.add(
coordinates: new firebase.firestore.GeoPoint(this.state.latitude, this.state.longitude),
mainPhotoURL: this.state.mainPhotoURL,
address: this.state.address,
nickName: this.state.nickName,
firebaseID: this.state.firebaseID,
).then((docRef) =>
console.log(docRef.id); // ID of newly added document
console.log(docRef);
, (error) =>
console.log('Error: ' + error);
);de here
If I take out mainphoto URL then it will upload. If I put it in the data set then it won't add to the database. I've console logged the mainphoto object and there is data inside of it. Has anyone run into this issue before?
1 Answer
1
According to my initial read of the documentation, It appears that you put coordinates only in the geoFirestore. Put your metadata such as nickname in a separate collection/document with a pointer to the geoFirestore uid.
A GeoFirestore instance is used to read and write geolocation data to
your Firestore database and to create queries.
geoFirestore.set(
'some_key': coordinates: new firebase.firestore.GeoPoint(37.79, -122.41),
'another_key': coordinates: new firebase.firestore.GeoPoint(36.98, -122.56)
).then(() =>
console.log('Provided keys have been added to GeoFirestore');
, (error) =>
console.log('Error: ' + error);
);
urls store just fine. try and cast it to
String(myurl)
or var url = "'" + myurl + "'"
. I store urls in firestore.– Ron Royston
Aug 10 at 16:38
String(myurl)
var url = "'" + myurl + "'"
I just tried that the following 1.value.toString() 2."" + value 3. String(value). I'm now getting "Function DocumentReference.set() called with invalid data."
– Kieran Tross
Aug 10 at 18:27
create an object first,
var obj =
then obj.myColor = "red"
then pass .set(obj)
.– Ron Royston
Aug 10 at 20:40
var obj =
obj.myColor = "red"
.set(obj)
I'm confused. how does this make the variable turn into a string. I've looked this up and I don't see the correlation using Set for object to string. Can you please provide more detailed code.
– Kieran Tross
Aug 13 at 12:40
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Even when I do a regular add to database without the geofirestore, the url reference won't upload.
– Kieran Tross
Aug 10 at 15:57