Skip to content
This repository was archived by the owner on Sep 18, 2024. It is now read-only.

mongodb-developer/mogobdb-csfle-csharp-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Notice: Repository Deprecation

This repository is deprecated and no longer actively maintained. It contains outdated code examples or practices that do not align with current MongoDB best practices. While the repository remains accessible for reference purposes, we strongly discourage its use in production environments. Users should be aware that this repository will not receive any further updates, bug fixes, or security patches. This code may expose you to security vulnerabilities, compatibility issues with current MongoDB versions, and potential performance problems. Any implementation based on this repository is at the user's own risk. For up-to-date resources, please refer to the MongoDB Developer Center.

Client-Side Field Level Encryption with MongoDB & .NET Driver

This is the sample application created in the Client-Side Field Level Encryption (CSFLE) in MongoDB with C# tutorial by Adrienne Tacke. Feel free to clone this repo and follow along with the steps in the tutorial.

Dependencies

Running the application

  1. Clone this repository:

     git clone https://github.com/adriennetacke/mongodb-csfle-csharp-demo.git 
  2. If running locally, start a mongod instance (Enterprise version >= 4.2) running on port 27017.

  3. In the launchSettings.json file, update the MDB_URI variable.

  • MongoDB Atlas: If using a MongoDB Atlas cluster, be sure to update the <user>, <password>, and <yourcluster> portions of the URI with your own credentials.
  • Local: If running a local MongoDB instance and haven't changed any default settings, you can replace what's already in the file with the default connection string: mongodb://localhost:27017.

Alternatively, you can add this variable to your host machine's environment variables as well. Note that you may have to restart Visual Studio for the variable to be registered.

💡 If you decide to use the launchSettings.json file, be sure to immediately add it to your .gitignore file so that you don't inadvertently expose your URI to the world! On a similar note, do not paste in your connection string directly into the code! Well, why is there a launchSettings.json file in your repo, Adrienne? I've deliberately left this file in to make development a bit easier should you decide to clone this repo. :)

  1. When running the first time, a a key file will be generated. Make sure that this key file is in the root of your execution environment (it will automatically do this when generated). If you move it, be sure to also update the key file path variables in the code.

More MongoDB Tutorials

Check out these other tutorials from Adrienne:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages