I have a MeetingService that retrieves data from my RethinkDB through HorizonIO. When I try to get a meeting through my identifier, I always get a zero value as an answer. Other methods in this service work without problems.
meeting.service.ts:
getMeetingById(passedId: string): Observable<Meeting[]> { return this.table.find({meetingId: passedId}).fetch(); }
conference detail.component.ts:
currentMeeting: Meeting; getCurrentMeeting(): void { this._meetingsService.getMeetingById(this.passedId).subscribe( (returnMeetings: Meeting[]) => { this.currentMeeting = returnMeetings[0]; } ); }
Even when I change passId to ID, I got directly from my db (through the admin panel), the method still returns null.
If I changed the code to return the first value in the table, everything will work.
getMeetingById(passedId: string): Observable<Meeting[]> { return this.table.order("meetingId", "descending").limit(1).fetch(); }
The end result is an undefined error in currentMeeting var in my view:
EXCEPTION: Error in ./MeetingDetailComponent class MeetingDetailComponent - inline template:1:4 caused by: Cannot read property 'meetingId' of undefined
Edit: additional code showing various implementations:
load() { if(this.passedId != null) { this._feedService.GetFeedById(this.passedId).subscribe( (returnFeed: Feed[]) => { this.currentFeed = returnFeed[0]; } ); } else { this._feedService.GetFirstFeed().subscribe( (returnFeed: Feed[]) => { this.currentFeed = returnFeed[0]; } ); } }
The second one works, firstly, no. The past identifier is correct and also available in the database, so this is rather confusing.
Thanks in advance.