I’m a bit confused about when to use quotes in the queries. In the MongoDB documentation, it doesn’t use quotes for the aggregation but in the examples you give, you use quotes. Can you please clarify? Thank you.
Basically, there are only a few instances where you absolutely MUST use quotes in a query or in the aggregation steps; however, those can be somewhat difficult to figure out and are really more than I can outline here.
The best strategy is to always use quotes – you can’t go wrong that way. FWIW, a lot of the lectures and the lecturers, since they’re very familiar with the language, tend to skip the quotes to save time (I do it myself a lot in my work ) but it’s a bad habit and I think somewhat confusing for students.