Closed slim-hmidi closed 6 years ago
I'm trying to get data from postgresql database using rxjs and objection:
const Data$ = Observable.create((observer) => { estab .query() .where('estab.type', 'like', 'hotels') .then((hotels) => { hotels.forEach((hotel) => { observer.next(hotel.data); observer.complete(); }); }); }); Data$.subscribe((payload) => { console.log('payload: ', payload); });
I got such a result:
{{ web: 'website', city: [Object], code: 1111, name: [Object], rooms: [Array], address: [Object] }, { web: 'website', city: [Object], code: 2222, name: [Object], rooms: [Array], address: [Object] }}
In the database the columns name, city, address, rooms contains data saved as object type. I didn't understand why when I parse data with rxjs I can't display object type. How can I fix that?
name, city, address, rooms
I solved the issue with:
Data$.subscribe((payload) => { console.log('payload: ', JSON.stringify(payload)); });
I'm trying to get data from postgresql database using rxjs and objection:
I got such a result:
In the database the columns
name, city, address, rooms
contains data saved as object type. I didn't understand why when I parse data with rxjs I can't display object type. How can I fix that?