public void Show() { MongoData data = new MongoData(dbname); foreach (var tt in data.GetDataFromMongo(dbname).FindAll()) { Console.WriteLine(tt["Message"].AsString); } }
private static void ExceptionCase(string message, bool exit) { mongodata = null; if (exit) Environment.Exit(0); }
public static MongoListener MongoListenerLoad(string name, Listeners outputfiles) { mongodata = new MongoData(name); MongoCollection collection = null; try { MongoServer server = MongoServer.Create(); server.Connect(); var db = server.GetDatabase(name); collection = db.GetCollection<BsonDocument>(name); } catch (MongoAuthenticationException) { ExceptionCase("MongoAuthenticationException", false); } catch (MongoConnectionException) { ExceptionCase("Trouble with Connection to MongoDB", false); } catch (Exception) { ExceptionCase("Unknown Exception", false); } return new MongoListener(name, outputfiles,collection); }
public void MongoGetTest() { MongoListener xml = MongoListener.MongoListenerLoad("AnotherBase"); MongoData data = new MongoData("AnotherBase"); }
public long Size() { MongoData data = new MongoData(dbname); return data.GetDataFromMongo(dbname).Count(); }
public void ClearBase(string dbname) { MongoData data = new MongoData(dbname); data.GetDataFromMongo(dbname).RemoveAll(); }
public MongoInfo(string dbname, MongoData data) { this.dbname = dbname; this.data = data; this.servercount = data.GetServerCount(); }