示例#1
0
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Connecting...");

                var client = new MongoClient("mongodb+srv://abuzduga:[email protected]/EducatedReality?retryWrites=true&w=majority");

                var database = client.GetDatabase("EducatedReality");
                parkCollection = database.GetCollection <ParkDesign>("ParkDesigns");

                var parkDesign1 = new ParkDesign()
                {
                    Description = "tets",
                    Longitude   = "10",
                    Latitude    = "10",
                    VideoUrl    = "123"
                };

                Insert(parkDesign1);

                var parkDesigns = GetAll();

                foreach (var parkDesign in parkDesigns)
                {
                    Console.WriteLine($"Description: {parkDesign.Description}");
                    Console.WriteLine($"VideoUrl: {parkDesign.VideoUrl}");
                    Console.WriteLine($"Latitude: {parkDesign.Latitude}");
                    Console.WriteLine($"Longitude: {parkDesign.Longitude}");
                }

                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
示例#2
0
 public static void Insert(ParkDesign entity)
 {
     parkCollection.InsertOne(entity);
 }