Comments (4)
The set function requires a full document, so the original with modifications, not just the modifications (as it looks for coordinates). So you'll want something like this:
const restaurantsGeostoreRef = db.collection('exploreMap');
const restaurantsRef = new GeoFirestore(restaurantsGeostoreRef);
export const addNewRestaurant = (data) => {
const doc = {
...data,
coordinates: new firebase.firestore.GeoPoint(data.coordinates[1], data.coordinates[0]),
};
restaurantsRef.add(doc)
.then(docRef => restaurantsRef.set(docRef.id, { id: docRef.id, ...doc })
.then(() => 'Successfully added.')
.catch(error => error)
).catch(error => error);
}
from geofirestore-js.
@AndrewAi I would advise you to use the libraries set method, as it has to parse your document for changes/adjustments. However for remove it wont matter.
from geofirestore-js.
Works, appreciate it!
from geofirestore-js.
Can I still use firestore's set method, or would it be better to using geofirestores implementation of the set method? similarly with the remove method, if I just remove the document, it will just be deleted but all the other won't be affected.
Thank you for the library, its brilliant so far!
from geofirestore-js.
Related Issues (20)
- Paginating data after fetched HOT 1
- Question - how can I find near documents with each unique radius? HOT 11
- How to write to firestore after geofirestore query HOT 1
- can't write to firestore properly after geofirestore query HOT 1
- StartAt or startAfter support HOT 1
- Query speed HOT 6
- Custom document key HOT 1
- Geoqueries with additional queries? HOT 3
- When querying `near`: `distance` prop is missing when distance is 0 HOT 1
- Support for Firebase JS SDK 9 HOT 9
- customKey not working on read HOT 10
- Pass a custom document ID HOT 1
- Query returning zero results when filtering with where HOT 8
- Support for new firestore 9.x? HOT 1
- runTransaction on a collection (server-side using cloud functions) HOT 1
- firebase geofirestore v9 not working HOT 1
- Bug double removed on a marker HOT 1
- Geofirestore and onSnapshot are giving delayed events - information is not updating properly
- Unsubscribe from GeoQuery.onSnapshot on document deletion HOT 1
- Typescript errors when trying to deploy function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geofirestore-js.