Thursday, 12 September 2013

mongodb pymongo geonear results loop

mongodb pymongo geonear results loop

im using geonear to get a list of results from mongodb (with distance
included) this is what i get back
[{u'obj': {u'_id': ObjectId('5210bc7fa861b40ba0745c1b'), u'loc': {u'type':
u'Point',
u'coordinates': [1.063122, 51.856272]}}, u'dis': 0.0044619326805318904},
{u'obj': {u'_id': ObjectId('5210c1f9a861b40ba0745c1e'), u'loc': {u'type':
u'Point',
u'coordinates': [0.933004, 51.90634]}}, u'dis': 10536.105585810197}]
my problem is that im not able to loop through the results and display
each document i believe it is because it is returning a list rather than a
dict is that correct ?
how would i loop through and display the results
many thanks
Rob

No comments:

Post a Comment