Esempio n. 1
0
 public void Show()
 {
     MongoData data = new MongoData(dbname);
     foreach (var tt in data.GetDataFromMongo(dbname).FindAll())
     {
         Console.WriteLine(tt["Message"].AsString);
     }
 }
Esempio n. 2
0
 private static void ExceptionCase(string message, bool exit)
 {
     mongodata = null;
     if (exit) Environment.Exit(0);
 }
Esempio n. 3
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);
            }
Esempio n. 4
0
 public void MongoGetTest()
 {
     MongoListener xml = MongoListener.MongoListenerLoad("AnotherBase");
        MongoData data = new MongoData("AnotherBase");
 }
Esempio n. 5
0
 public long Size()
 {
     MongoData data = new MongoData(dbname);
     return data.GetDataFromMongo(dbname).Count();
 }
Esempio n. 6
0
 public void ClearBase(string dbname)
 {
     MongoData data = new MongoData(dbname);
     data.GetDataFromMongo(dbname).RemoveAll();
 }
Esempio n. 7
0
 public MongoInfo(string dbname, MongoData data)
 {
     this.dbname = dbname;
     this.data = data;
     this.servercount = data.GetServerCount();
 }