Ejemplo n.º 1
0
        public GeospatialTests()
        {
            _server = Mongo.Create("mongodb://localhost/NormTests?pooling=false");
            _collection = _server.GetCollection<GeoTestClass>("LatLngTests");

            _collection.Insert(new GeoTestClass { Location = new LatLng { Latitude = 57.1056, Longitude = 12.2508 }, Name = "Varberg"});
            _collection.Insert(new GeoTestClass { Location = new LatLng { Latitude = 57.7, Longitude = 11.9166667 }, Name = "Gothenburg" }); //  ~70km North of Varberg
            _collection.Insert(new GeoTestClass { Location = new LatLng { Latitude = 29.950975, Longitude = -90.081217 }, Name = "New Orleans Saints" });
            _collection.Insert(new GeoTestClass { Location = new LatLng { Latitude = 44.973876, Longitude = -93.258133 }, Name = "Minnesota Vikings" });
            _collection.Insert(new GeoTestClass { Location = new LatLng { Latitude = 0, Longitude = 0 }, Name = "Center of the Earth" });
            _collection.CreateGeoIndex(geo => geo.Location, "loc", true);
        }