Closed
Description
Hello,
Running the following example which uses $geoNear in an aggregation pipeline returns a $geoNear is only valid as the first stage in a pipeline
error.
from mongoengine import *
def aggregate():
connect()
class BaseClass(Document):
meta = {'allow_inheritance': True}
class Aggr(BaseClass):
name = StringField()
c = PointField()
Aggr.drop_collection()
Aggr(name="X", c=[10.634584, 35.8245029]).save()
Aggr(name="Y", c=[10.634584, 35.8245029]).save()
pipeline = [
{
"$geoNear": {
"near": {"type": "Point", "coordinates": [10.634584, 35.8245029]},
"distanceField": "c",
"spherical": True,
}
}
]
list(Aggr.objects.aggregate(*pipeline))
aggregate()
Using:
mongoengine: 0.17.0
MongoDB server version: 4.4.0
Metadata
Metadata
Assignees
Labels
No labels