When querying Firestore the browser is returning [object Object],[object Object] instead of:
{
> Description: 'This is a job offer',
> Active: true,
> Location: 'Warsaw',
> Name: 'BA in Bank',
> Deadline: Timestamp { _seconds: 1603317600, _nanoseconds: 0 }
> }
> {
> Description: 'This is another job offer',
> Location: 'Amesterdam',
> Name: 'PM job',
> Active: true,
> Deadline: Timestamp { _seconds: 1607554800, _nanoseconds: 0 }
> }
This is a route and I would like to pass the array so I can render it on EJS view dynamically.
router.get('/projects', async(req, res) => {
var array = [];
const snapshot = await firebase.firestore().collection('projects').get()
snapshot.forEach(doc => {
array.push(doc.data());
})
res.render('projects', { array })
});
Is there a way to pass these object values on the route handler?
res.render('projects', { JSON.stringify(array) })