i'm trying to perform a lookup in mongodb to get data from two tables. Here is what i have created so far:
database.collection('surveys').aggregate([
{ $lookup:
{
from: 'questions',
localField: '_id',
foreignField: 'surveyId',
as: 'questions'
}
}
]).toArray(function(err, res) {
if (err) throw err;
console.log(JSON.stringify(res));
});
The problem is that the data from my survey table are shown well, but the data from my questions table are always an empty array and I don't know why. Please find attached two screenshots of my database structure.

