December 2019
Intermediate to advanced
494 pages
11h 41m
English
Working with MongoDB using .NET Core isn't all that difficult either. Create a new console application and install the MongoDB.Driver package using NuGet:
using MongoDB.Bson;using MongoDB.Driver;using System;using System.Collections.Generic;namespace CosmosMongoDbConnection{ internal class Program { private static void Main(string[] args) { var client = new MongoClient("mongodb://migrationsdocdb:rdnkUFEE41B6TyRYRnnudmvoDYkPzULclKsTcJYPsSNNN6R4CyMjB0pKIAvh8oybIT6zDy8ZNqHtpy8j56Gswg==@migrationsdocdb.documents.azure.com:10255/?ssl=true&replicaSet=globaldb"); IMongoDatabase db = client.GetDatabase("somedb"); IMongoCollection<Person> collection = db.GetCollection<Person>("people"); collection.InsertOne(new Person ...