Exemplo n.º 1
0
        public static void GenerateMongoDB ()
        {
            var json = new MongoJson();
            var mongo = new Mongo();

            mongo.Connect();

            //Create clean database and collection for Notes
            var db = mongo["SupermarkertsDB"];
            db.SendCommand("dropDatabase");
            var products = db["Products"];

            List<int> ids;
            var jsonData = GenerateJSONReports.ExatractJsonData(out ids);
            foreach (var item in jsonData)
            {
                var jsonDocument = json.DocumentFrom(item);
                products.Insert(jsonDocument);
            }           
            
            mongo.Disconnect();
        }
Exemplo n.º 2
0
 public LogRepository()
 {
     db = base.Init().MDB.GetDatabase("logstore");
     json = base.Init().json;
     logs = db.GetCollection("entries");
 }