Skip to content

Commit

Permalink
Changing collections.remove to delete_many.
Browse files Browse the repository at this point in the history
PyMongo 4.x does not have collections.remove anymore therefore I will change it to delete_one or delete_many.
Contains fix for the issue:
e-mission/e-mission-docs#856 (comment)
  • Loading branch information
swastis10 committed Mar 6, 2023
1 parent 5ee9e54 commit cb8d4ae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions emission/tests/storageTests/TestMongoGeoJSONQueries.py
Expand Up @@ -17,7 +17,7 @@ def setUp(self):
self.Sections=get_test_db()

def tearDown(self):
get_test_db().remove()
get_test_db().delete_many({})

def testGeoWithinPostsData(self):
post1 = {"author": "Mike",
Expand Down Expand Up @@ -112,11 +112,11 @@ def getTestNegPolygon(self):
[-123,38],[-123,37]]

def testGeoWithNegativeValues(self):
test = {'track_location': {'type':'Point', 'coordinates': [122.5,37.5]} }
test = {'track_location': {'type':'Point', 'coordinates': [-122.5,37.5]} }
self.Sections.insert_one(test)

retVal = []
for a in self.Sections.find({ "track_location" : { "$geoWithin" : { "$polygon" : [ [122,37],[122,38],[123,38],[123,37]] } } }):
for a in self.Sections.find({ "track_location" : { "$geoWithin" : { "$polygon" : self.getTestNegPolygon() } } }):
retVal.append(a)
print("Found match for %s" % a)

Expand Down

0 comments on commit cb8d4ae

Please sign in to comment.