File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -510,6 +510,24 @@ class Road(Document):
510510 roads = Road .objects .filter (poly__geo_intersects = {"$geometry" : polygon }).count ()
511511 self .assertEqual (1 , roads )
512512
513+ def test_aspymongo_with_only (self ):
514+ """Ensure as_pymongo works with only"""
515+ class Place (Document ):
516+ location = PointField ()
517+
518+ Place .drop_collection ()
519+ p = Place (location = [24.946861267089844 , 60.16311983618494 ])
520+ p .save ()
521+ qs = Place .objects ().only ('location' )
522+ self .assertDictEqual (
523+ qs .as_pymongo ()[0 ]['location' ],
524+ {u'type' : u'Point' ,
525+ u'coordinates' : [
526+ 24.946861267089844 ,
527+ 60.16311983618494 ]
528+ }
529+ )
530+
513531 def test_2dsphere_point_sets_correctly (self ):
514532 class Location (Document ):
515533 loc = PointField ()
You can’t perform that action at this time.
0 commit comments