Hey everyone,
I’m new to MongoDB and I’m trying to get a lookup to work. I’ve build a demo project with tournaments
and each tournament document has an array of matches (ObjectId’s to be specific), which obviously are documents in a matches
collection.
I wrote this in JavaScript, but am I doing something wrong since it’s about ObjectId’s?
db.collection('tournaments').aggregate([
{
$lookup: {
from: 'matches',
localField: 'matches',
foreignField: '_id',
as: 'matchesList',
},
},
]);
Thanks in advance!
Gr,
Andy