Quotation symbols

please bear with me on this basic question… I see:

a. config files - never use quotation symbols

b. mongo commands with quotation symbols used
user: “m103-admin”, …

c. vagrant commands displayed without quotation symbols i.e.
vagrant@m103:~ mongo --port 26000 --username m103-admin but which require quotation symbols I think i.e. vagrant@m103:~ mongo --port 26000 --username “m103-admin”

do the syntax rules differ by user’s OS?
are the display/examples provided presuming an OS?

a. Screenshot from config file lecture:

Screenshot from config file documentation:
The Config File is written in YAML and YAML allows strings to be written with/without quotes under certain conditions. Refer to the YAML documentation to understand quoting. As a guideline, if the MongoDB Config File documentation states that the parameter is a <string> or the string contains spaces, it’s good programming practice to enclose it in quotes. There are also certain Config File options that require specific type of quotes. Generally, quotes act as a boundary and are used when parsing text.
b. Screenshot from rs.add()
If you follow the advice above re what to do when you see <string>, you’ll be fine in this scenario too. Here it’s not using YAML so quotes are mandatory.
c. In the vagrant prompt you’re running under an Ubuntu Linux environment and quotes are required under certain conditions. If you recall what I mentioned earlier, if the string contains a space it must be quoted otherwise it will think that the character after the space is another option being passed. In the case of username there’s no space so quotes can be omitted. A Windows terminal follows similar rules.

So again, quote when you know that the parameter/argument is a <string>.

1 Like

Hi @James_58604,

I hope you found the response from @007_jb helpful. If you still have any questions then please feel free to get back to us.

Shubham Ranjan
Curriculum Support Engineer

007 has been super helpful - -
this post is only about strings - fully understand number, boolean are different - just strings. should have been more clear on this point in my original post.

the reply is what my original tech view in regard to a string being surrounded by “”…i.e. strings always surround

but over the course of these lessons, and particularly now that I am in sharding - - there are a bunch of config files that are offered/downloaded/required as part of the lesson - - and none use " " symbols at all. …and these are fields that are defined as strings…

so first I was thinking I needed to go in and add them - - which seems a little weird - - and then I thought maybe I didn’t - - and then I thought maybe it depends on one’s OS… and then I asked the question

it is still not really clear if I have to go into all the copied config files from the shard course and add the " " symbols throughout…one wouldn’t think so - - will try it and see…