public void Initlization() { var cursor = MongoDriverClient.GetDatabaseList(); foreach (var database in cursor.ToEnumerable()) { if (database["name"] == null) { Console.WriteLine("database name is null"); continue; } String databaseName = database["name"].ToString(); var mongoDatabase = MongoDriverClient.GetDatabase(databaseName); var collectionCursor = MongoDriverClient.GetCollections(mongoDatabase); foreach (var collection in collectionCursor.ToEnumerable()) { String collectionName = collection["name"].ToString(); Console.WriteLine($"Initlization"); Console.WriteLine($"databaseName : {databaseName}"); Console.WriteLine($"collectionName : {collectionName}"); Console.WriteLine($"===========================================\n\n"); String typeName = collectionName.ToLower(); String indexName = databaseName.ToLower() + "." + typeName; var documents = MongoDriverClient.FindAll <BsonDocument>(mongoDatabase, collectionName); Console.WriteLine($"document count : {documents.Count}"); InitES(indexName, typeName, documents); } } }
public MongoOpLogManager() { _local = MongoDriverClient.GetDatabase("local"); _opLog = _local.GetCollection <OpLog>("oplog.rs"); }
private void InitSetting() { var database = MongoDriverClient.GetDatabase("SETTING"); }