Skip to content

Instantly share code, notes, and snippets.

@kaushikraj
kaushikraj / ConnectionInformation.cs
Last active August 29, 2015 13:56
A simple wrapper to GridFS in mongodb for CRUD functionality on files.
/// <summary>
/// Singleton for MongoDB connection (just a sample - for an idea)
/// </summary>
public class ConnectionInformation
{
#region fields
private static ConnectionInformation instance;
private static object syncLock = new object();
@kaushikraj
kaushikraj / flipflop.cs
Created February 2, 2014 16:39
C# implementation of inserting documents in mongodb with replicaset. The code inserts 100 documents and recovers from insert failure. (similar code to python's implementation at https://gist.github.com/mongolab-org/5347810)
using MongoDB.Bson;
using MongoDB.Driver;
using System;
using System.Threading;
using System.IO;
namespace ConsoleApplication1
{
public class Stamp