firebase / firebase/geofire-js
Multi-paths update and Geofire
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 339
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
As mentioned [here](https://groups.google.com/forum/#!topic/firebase-talk/rZzXgFjK2CE), I think it should be great to easily multi update data paths and a geofire path at the same time. As the set of Geofire is pretty complex, it's hard to directly copy/paste the code to make it works.
Here the use case : (I use the same as the link above but add a path to know where a post is located). So the structure :
```
{
posts: {
post1: {
from : user1,
message: "Hi",
},
post2: {
from : user2,
message: "Hey",
}
},
posts-location: {
post1: {
g : 'xxxxxxxx',
l: {
0 : latitude,
1 : longitude
}
},
post2: {
g : 'xxxxxxxx',
l: {
0 : latitude,
1 : longitude
}
}
},
users: {
user1: {
posts: {
post1: true
}
},
user2: {
posts: {
post2: true
}
}
}
}
```
Now I can add a post at the same time at users and posts (with multi-path update). But I need to set the position after. In my use case, a post without a position is not valid data, it's for that the best should be to do the 3 updates at the same times (if one fails, all fail).
Deleting Geofire path is easy (using update(null)), we can multi-update for delete, but for set/update, I loop for a way to do that easily,
Cheers,
Clément
Contributor guide
Assessment
This issue has not been assessed yet.