Need help with error? zsh: parse error near '&'

Hi All,

I’m a new user to Mongodb, im trying to add my connection string to my application code but keep getting the following error on Mac terminal.

Error code. zsh: parse error near `&’

Any suggestions? (password is generic)

Connection string:

% mongodb+srv://dxnn:<db_password>@tull-online.z79os.mongodb.net/?retryWrites=true&w=majority&appName=Tull-online

Hi @dxnnxil, this sounds like you need to wrap the connection string in quotes – for example, if you want to connect to this cluster with mongosh, you’d use

mongosh 'mongodb+srv://dxnn:<db_password>@tull-online.z79os.mongodb.net/?retryWrites=true&w=majority&appName=Tull-online'

That being said, can you share a bit about how you’re trying to add the connection string to your application code? That’s not a process that’s typically done through the terminal (unless you prefer terminal-based editors, but few people do), so I want to make sure I’m understanding your problem correctly.

1 Like