Closed srobertson421 closed 5 years ago
Fiddled around and used the doc().set()
method instead. Works just fine so we're good there, but still curious why add()
was failing.
So add doesn't require the object details you're putting in with your setNewPlace function. It just takes the place object and creates all of those fields. I'm like 99.99% confident thats the problem. Don't build the object manually and just send the place object.
Ah got it, ok that makes sense. Thanks for the quick response!
I'm trying to utilize the
add()
method. I followed the data structure listed here: https://github.com/geofirestore/spittin-hot-geofirestore/blob/6a9c3482f8437f594c78743eb4fd96aee777a63b/data/src/utils.ts#L19I'm getting an error that the data has an invalid key. I was under the assumption the library looked for the
coordinates
key within thed
object. Am I missing something or do I have to provide a key?Here is my code:
My firebase config:
Setting the state in my React component, I'm building the geodata object out manually:
Then calling the
add
method: