Добрый день.У меня есть 3 коллекции и схема:
locations :
- id (Auto generated by firebase)
- location_city
- location_country
venues:
- id ( auto generated by firebase)
- venue_name
- venue_address
- location_id (this is related to the locations collection)
events:
- id (auto generated by firebase)
- event_name
- venues:
[0] venue_id_1
[1] venue_id_2
Я хочу отфильтровать события, принадлежащие месту, например, список всех событий, которые доступны в Токио, Япония
Вот что ядо сих пор пробовал (Angular 7), я новичок в firebase, поэтому не уверен, что пишу это правильно или неправильно ...
// вызов компонента фильтра
filterEvents() {
this.filterByEvents = true;
if (!this.executedEventFilter) {
this.executedEventFilter = true;
this.LocationManagementService.filterByEvents(this.LocationManagementService.locationId);
}
сервисный дескриптор, который
filterByEvents(locationId) {
const locationsRef = firebase.database().ref().child("locations");
const venuesRef = firebase.database().ref().child("venues");
const eventsRef = firebase.database().ref().child("events");
return new Promise<any>((resolve, reject) => {
eventsRef.on('child_added', (snapEvent) => {
console.log(snapEvent);
})
});
}