'Ensure the "max_distance" operator works alongside the "near"
operator with a 2dsphere index.'

def test_2dsphere_near_and_max_distance(self):

    (event1, event2, event3) = self._create_event_data(point_field_class=PointField)
    point = [(-122.415579), 37.7566023]
    events = self.Event.objects(location__near=point, location__max_distance=10000)
    self.assertEqual(events.count(), 1)
    self.assertEqual(events[0], event2)
    events = self.Event.objects(location__near=[(-73.9509714), 40.7237134], location__max_distance=1000)
    self.assertEqual(events.count(), 0)
    events = self.Event.objects(location__near=[(-87.67892), 41.9120459], location__max_distance=10000).order_by('-date')
    self.assertEqual(events.count(), 2)
    self.assertEqual(events[0], event3)
