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); }
//private XDocument xdoc; //name - имя для бд public MongoListener(string name, Listeners outputfiles, MongoCollection coll) { mongoLogCollection = coll; this.outputfiles = outputfiles; this.dbname = name; }