Skip to content

Commit b3a905f

Browse files
committed
Try unsupported_functions again
1 parent c97a4fe commit b3a905f

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

django_mongodb_backend/compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def execute_sql(
359359
except EmptyResultSet:
360360
return iter([]) if result_type == MULTI else None
361361

362-
print(f"Query: {query}")
362+
# print(f"Query: {query}")
363363
cursor = query.get_cursor()
364364
if result_type == SINGLE:
365365
try:
@@ -786,7 +786,7 @@ def explain_query(self):
786786
for option in self.connection.ops.explain_options:
787787
if value := options.get(option):
788788
kwargs[option] = value
789-
print(f"PIPELINE: {pipeline}")
789+
# print(f"PIPELINE: {pipeline}")
790790
explain = self.connection.database.command(
791791
"explain",
792792
{"aggregate": self.collection_name, "pipeline": pipeline, "cursor": {}},

django_mongodb_backend/gis/features.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ class GISFeatures(BaseSpatialFeatures):
66
has_spatialrefsys_table = False
77
supports_transform = False
88
supports_distance_geodetic = False
9-
has_Distance_function = False
10-
has_Union_function = False
119

1210
@cached_property
1311
def django_test_expected_failures(self):
@@ -45,8 +43,8 @@ def django_test_skips(self):
4543
"gis_tests.distapp.tests.DistanceTest.test_distance_lookups",
4644
"gis_tests.distapp.tests.DistanceTest.test_distance_lookups_with_expression_rhs",
4745
"gis_tests.distapp.tests.DistanceTest.test_distance_annotation_group_by",
48-
"gis_tests.distapp.tests.DistanceFunctionsTests.test_distance_simple",
49-
"gis_tests.distapp.tests.DistanceFunctionsTests.test_distance_order_by",
46+
# "gis_tests.distapp.tests.DistanceFunctionsTests.test_distance_simple",
47+
# "gis_tests.distapp.tests.DistanceFunctionsTests.test_distance_order_by",
5048
},
5149
"ImproperlyConfigured isn't raised when using RasterField": {
5250
# Normally RasterField.db_type() raises an error, but MongoDB

django_mongodb_backend/gis/operations.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import warnings
2-
31
from django.contrib.gis import geos
42
from django.contrib.gis.db import models
53
from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations
64
from django.contrib.gis.measure import Distance
5+
from django.db import NotSupportedError
76
from django.db.backends.base.operations import BaseDatabaseOperations
87

98
from .adapter import Adapter
109
from .utils import SpatialOperator
1110

1211

1312
def _gis_within_operator(field, value, op=None, params=None):
14-
print(f"Within value: {value}")
13+
# print(f"Within value: {value}")
1514
return {
1615
field: {
1716
"$geoWithin": {
@@ -55,9 +54,7 @@ def _gis_disjoint_operator(field, value, op=None, params=None):
5554
def _gis_contains_operator(field, value, op=None, params=None):
5655
value_type = value["type"]
5756
if value_type != "Point":
58-
warnings.warn(
59-
"MongoDB does not support strict contains on non-Point query geometries. Results will be for intersection."
60-
)
57+
raise NotSupportedError("MongoDB does not support contains on non-Point query geometries.")
6158
return {
6259
field: {
6360
"$geoIntersects": {
@@ -71,7 +68,7 @@ def _gis_contains_operator(field, value, op=None, params=None):
7168

7269

7370
def _gis_distance_operator(field, value, op=None, params=None):
74-
print(f"Distance: {params}")
71+
# print(f"Distance: {params}")
7572
if hasattr(params[0], "m"):
7673
distance = params[0].m
7774
else:
@@ -100,7 +97,7 @@ def _gis_distance_operator(field, value, op=None, params=None):
10097
}
10198
}
10299
}
103-
print(f"Command: {cmd}")
100+
# print(f"Command: {cmd}")
104101
return cmd
105102

106103

@@ -140,6 +137,7 @@ def gis_operators(self):
140137
"BoundingCircle",
141138
"Centroid",
142139
"ClosestPoint",
140+
"Distance",
143141
"Difference",
144142
"Envelope",
145143
"ForcePolygonCW",

0 commit comments

Comments
 (0)