Expr Syntax model

In Chapter 4: Advanced CRUD Operations

Expressive Query Operator

the video shows the aggregation syntax as { : { , } }
but the actual commands are written as { : [ , ] }

I found this a little confusing. Is there an actual difference here or is it a typo in the lesson? this is the first introduction to aggregation syntax, but clearly the example is written with brackets and not curly braces, like in the following example from the lesson:

db.trips.find({ “$expr”: { “$eq”: [ “$end station id”, “$start station id”] }

Hi @James_Bellomy,

Welcome to the MongoDB University forums :sparkles:

The syntax of $expr shown in the video and the actual command both is correct and you can read more about that in our official documenation.

Just to clarify the square bracket [ ] shown in the actual command is being used to compare the two value using the $eq operator. To know more you can refer to our documentation here

I hope this answers your question. If you have any follow-up questions, please feel free to reach out.



thank you for the quick reply and clearing up my confusion!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.