Hello all.
I’m trying to follow along with the Basic Joins video lecture in chapter 2, but am having trouble matching the code exactly. I find it difficult to attempt to copy the code exactly from the video and honestly wish they provided the code snippets for the video to make it easier to follow along (they’ve done that with previous courses, so I’m uncertain why they didn’t do it with this one). And if I’m missing something and they actually do provide the code snippets somewhere that I’m missing, please someone point it out to me.
Around 1:47 in the video lecture, he starts talking about the $look aggregation part and that’s the snippet I’m having trouble getting the syntax correct on. Below I’ll past what I have in my $lookup aggregation box in compass (and what, to me, looks to be what the lecturer has in his $lookup aggregation box):
{
from: ‘comments’,
let: {‘id’: ‘$.id’},
pipeline: [
{ ‘$match’:
{ ‘$expr’: { ‘$eq’: [ ‘$movie.id’, ‘$$id’ ] }
}
],
as: ‘movie.comments’
}
Below the box I’m getting the warning message " Expected “[” or AggregationStage but “{” found. "
Here’s what I would expect to go in the $lookup box (to close all the open curly braces):
{
from: ‘comments’,
let: {‘id’: ‘$.id’},
pipeline: [
{ ‘$match’:
{ ‘$expr’: { ‘$eq’: [ ‘$movie.id’, ‘$$id’ ] } }
}
],
as: ‘movie.comments’
}
But that gives me “FieldPath field names may not be empty strings.”
I’m sure the error I’m making is small and simple, but I’m unable to find it and have been look at this code snippet for a while now. Any input would be greatly appreciated, thanks.
Edit: added screenshots of where I am in compass for clarity
Edit 2: I tried to format the code I pasted in for easy readability, but the preview seems to be removing spaces and indents. Apologies to people trying to read it.