No, it's an array of documents, one document for each stage of the pipeline. Yes, we'll go through that example, twice.
{$set: {name: ""Lord Voldemort"", back: true, nose: false}}
But addr.city is:
{$set: {""addr.city"": ""Little Whinging"", ""addr.county"": ""Surry""}}"
Great question. We have dots in the second example because city and county are keys/properties within the address document. So, there's layers of structure there.
We have to use quotation marks when there are odd characters, such as a dot, in the name of a property/key.
There are two kinds of documents here. The query document and the database document. The database document is the one with extra layers. The query document is intended to match, and so we end up with dots.
All good questions. The aggregation pipeline is powerful but complicated. In this class, you should try to do computations in the database whenever possible. If it's not obvious, consult with me and we can try to figure it out together. If we can't, we'll compute in JavaScript.
Sure. Here's some documentation on $set.
Wow! You are right! Thanks so much for noticing that!
Good. Let's discuss many-to-many mappings?
Yes, that makes sense.
Glad to hear it!