When to use square brackets.... any tips?

When using mongoshell sometimes the commans use square brackets… is there any tip to know when you have to use them … or it is something that one have to learn and know it by heart???

In short:

Square brackets are for arrays.

Parenthesis delimits the parameters of a function.

Curly braces are object delimiters. They also define code scope.

Hi @Jose_20145,

Please refer our documentation on documents in MongoDB and then you should have a clear understanding of the structure and different components of documents in MongoDB.

If you still have any other query please feel free to get back to us.

Happy Learning :slight_smile:

Shubham Ranjan
Curriculum Support Engineer