#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pymongo
from pymongo import Connection
import gridfs
strConn = 'mongodb://xxxxx:xxxxx@xxxxx/test?slaveOk=true'
dbname = 'test'
__connection = Connection( strConn )
db = __connection[dbname]
cursor = db.picture.files.find()
while cursor.alive:
try:
resultDict = cursor.next()
print resultDict
except StopIteration, e:
isAlive = False
break
except Exception, e:
print str(e)