I am using Azure cosmos dB Emulator to do CRUD operations on MongoDB using MongoDB C# Drivers. I am able to create DB and collection using C# in emulator. This is my sample code to create DB and Collection..
IMongoDatabase db = dbClient.GetDatabase("<My DB name>");
db.CreateCollection("<Collection Name>");
These queries are working fine but when I am trying to insert sample data into this collection its throwing below error
Command insert failed: Unknown server error occurred when processing this request..
My sample code to insert sample data is
IMongoCollection<UserProfile> collection = db.GetCollection<UserProfile("<Collection Name>");
UserProfile c = new UserProfile();
c.ID = 21;
c.UserName = "<Some Name> ";
c.Email = "<Email ID>";
collection.InsertOne(c);
How to use MongoDB C# Drivers to do CRUD operations in Azure cosmos dB Emulator And how to run mongo queries in Emulator instead of SQL queries? Thanks in Advance