Feedback on Chapter 2: User-Facing Backend Basic Joins video

The expressive $lookup syntax is quite complicated, and there is no template for it in Compass (yet?). As it is, we have to type it in by hand from the video, and the video is not clear.

It would be nice if there were a cut-and-paste template for that, underneath the video lecture itself, similar to the current one received from Compass:

{
from: '<<string>>',
localField: '<<string>>',
foreignField: '<<string>>',
as: '<<string>>'
}

Something like, e.g:

{
 from: <<string>>,
 let: { <<var1>>:<<inner_var>>},
 pipeline: [
    { <<operator>>: { $expr: { $eq: [ <<outer_var> , <<var_1>> ] } } },
 ],
 as: <<string>>
}

I agree the I feel like the lookup lesson should first go over the basic “joins” using the normal $lookup syntax then go into expressive lookup.

The normal lookup is good for simple joins.

Expressive lookup looks to be really powerful as it lets you mold / aggregate the data from the separate collection but the way it’s used here is un-necessary. I would like to see an example where expressive lookup really made a difference.

This would help people realize why the need for the two different syntax as well as when to use which. This was my first exposure to expressive lookup and I had to do a lot of research after the lesson to understand the need for it.

2 Likes

+1 (Not so clear video).

For other users - This is the code from the video.

$lookup :

{
  from: 'comments',
  let: { 'id': '$_id' },
  pipeline: [
    { '$match':
      { '$expr': 
        { '$eq': [ '$movie_id', '$$id' ] }
      }
    },
    { $count: 'count' }
  ],
  as: 'movie_comments'
}

Also, this specific video Quality is bad (The text not readable) // Looks blurry.

**Screenshot 720p

image

Thanks for your feedback, though updating the video might take some time, we will consider adding code shared in the videos in the lecture notes.

For the mean time, please take a look at the lesson scripts/documentation to understand the syntax and pipelines.

Kanika

I also didn’t realize lookups and expressive lookups were separate things. I thought the video was just out of date and what came up on compass when I selected lookup was the new syntax.