![]() The list the collections: MongoClient dbClient = new MongoClient("mongodb://localhost:27017") CollectionsĪs we saw in the previous post, Mongo works around the concept of collections – it’s roughly analogous to a table. See the referenced previous post if you’re interested where testdb came from. So to connect to the DB, you would use this: MongoClient dbClient = new MongoClient("mongodb://localhost:27017") It actually took me a while to work out the correct format here for the default instance, you can simply use this for the connection string: mongodb://localhost:27017 You’ll need the following using statement: using MongoDB.Driver Once that’s installed, you should have access to the SDK. Bring in a NuGet PackageĪs with many integrations in the last 10 years, 90% of the job is installing the right NuGet package: Install-Package MongoDB.Driver In this post I’ll cover setting up a simple C# client to interrogate the database. ![]() In this previous post I wrote about how you can install MongoDB, and use the built in clients to interrogate the data.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |