JeremyLikness / explore-cosmos-db

.NET Core 2.0 project to demonstrate some capabilities of Cosmos DB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No Username/Password using CosmosDB Emulator

mgb-mark opened this issue · comments

I'm new to CosmosDB and trying this out locally using the CosmosDB emulator, but I have a problem with the connection strings. The emulator provides me with a MongoDB connection string in the format "mongodb://localhost:{key}@localhost:10255/admin?ssl=true", but your app requires discrete user, password, etc. I've tried using user = admin and password = {key} but this is failing.

Any suggestions?

Thanks.

var _databaseName = MongoUrl.Create(_connectionString).DatabaseName;
return new MongoClient(_connectionString).GetDatabase(_databaseName);

That should connect you in. I will reopen if it doesn't work.

Jeremy,

Sorry for the delayed response but I've been on other projects.
I'm afraid I have no idea where I'm supposed to add those lines in the project to make this work.

Any chance you can give me a clue what I am supposed to do with these lines of code?

Many thanks
Mark

Actually don't worry Jeremy, I've realised that I cannot run this demo anyway as I cannot install Docker for Windows locally.
Sorry to have troubled you.

No problem. The code would go in the MongoDB client class that is shared. Also, you don't have to run Docker. You can just navigate to the vue.js app locally, the Docker is just a "bonus" step.

Thanks Jeremy. I'll remember that if I can get an environment to try this in future.