Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MongoDB Lock - Setting Up
public class LockModel
// We only need an ID right now
public string Id { get; set; }
public class LockProvider
private readonly IMongoCollection<LockModel> collection;
public LockProvider(string mongodbConnString)
// Create a lock collection
var client = new MongoClient(mongodbConnString);
var database = client.GetDatabase("mydb");
// Get our collection
collection = database.GetCollection<LockModel>("resourceLocks");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment