I get the following ReferenceError... please help

ReferenceError: strong is not defined

I have a document inside the “baby-strong-v1” collection, yet I can never see it and get this error message that “strong” is not defined.
When I do show collections, I see ‘baby-strong-v1’ in my collection but I can’t enter data or view in from my mongodb shell. thanks

Hello @French_Mike,

The error your are getting is valid, when I tried your command in mongo shell. It is because of the usage of hyphen (’-’) within the name of a collection. To work with a collection having hyphen’s use the following syntax:


In general, to avoid such error you can use the underscore ("_") within the collection name, instead of the hyphen; for example baby_strong_v1

Here is the reference to the mongosh documentation about Database Methods.


Hi @French_Mike, since the MongoDB Shell is an interactive JavaScript interface, it treats the - as the Subtraction Operator.
You can use the following syntax to achieve the same:


Also, as Prasad mentioned, please avoid using - inside the collection name.

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer


thanks a lot, that was super useful…

1 Like